#!/usr/bin/env bash set -a source /usr/share/yunohost/helpers app="${0//.\/50-}" user=$1 mail=$2 arm64_test=0 final_path=$(ynh_app_setting_get --app=$app --key=final_path) backend_path="$final_path/backend" path_prefix="$backend_path/venv/bin" if [ "$YNH_ARCH" = "arm64" ] || [ "$arm64_test" -eq 1 ]; then export CONDA_DIR="$backend_path/conda" path_prefix="$backend_path/cmake/bin:$CONDA_DIR/condabin:$CONDA_DIR/bin:$path_prefix" fi pushd "$backend_path" ynh_exec_warn_less ynh_exec_as $app bash -c " set -a export PATH=\"$path_prefix:"'$PATH'"\" source \"$final_path\"/librephotos.env python3 manage.py shell " <<< " from django.contrib.auth import get_user_model User = get_user_model() try: user = User.objects.get(username='$user') user.scan_directory='/home/yunohost.multimedia/$user/Picture' user.is_active = True user.save() except User.DoesNotExist: User.objects.create_user('$user', email='$mail', scan_directory='/home/yunohost.multimedia/$user/Picture') " popd