diff --git a/scripts/_common.sh b/scripts/_common.sh index 8edb3df..68e3abc 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -124,30 +124,30 @@ myynh_install_immich() { ynh_use_nodejs # Install immich-server - cd "$tmpdir/server" + cd "$source_dir/server" ynh_exec_warn_less "$ynh_npm" ci ynh_exec_warn_less "$ynh_npm" run build ynh_exec_warn_less "$ynh_npm" prune --omit=dev --omit=optional - cd "$tmpdir/open-api/typescript-sdk" + cd "$source_dir/open-api/typescript-sdk" ynh_exec_warn_less "$ynh_npm" ci ynh_exec_warn_less "$ynh_npm" run build - cd "$tmpdir/web" + cd "$source_dir/web" ynh_exec_warn_less "$ynh_npm" ci ynh_exec_warn_less "$ynh_npm" run build mkdir -p "$install_dir/app/" - cp -a "$tmpdir/server/node_modules" "$install_dir/app/" - cp -a "$tmpdir/server/dist" "$install_dir/app/" - cp -a "$tmpdir/server/bin" "$install_dir/app/" - cp -a "$tmpdir/web/build" "$install_dir/app/www" - cp -a "$tmpdir/server/resources" "$install_dir/app/" - cp -a "$tmpdir/server/package.json" "$install_dir/app/" - cp -a "$tmpdir/server/package-lock.json" "$install_dir/app/" - cp -a "$tmpdir/server/start-microservices.sh" "$install_dir/app/" - cp -a "$tmpdir/server/start-server.sh" "$install_dir/app/" - cp -a "$tmpdir/LICENSE" "$install_dir/app/" + cp -a "$source_dir/server/node_modules" "$install_dir/app/" + cp -a "$source_dir/server/dist" "$install_dir/app/" + cp -a "$source_dir/server/bin" "$install_dir/app/" + cp -a "$source_dir/web/build" "$install_dir/app/www" + cp -a "$source_dir/server/resources" "$install_dir/app/" + cp -a "$source_dir/server/package.json" "$install_dir/app/" + cp -a "$source_dir/server/package-lock.json" "$install_dir/app/" + cp -a "$source_dir/server/start-microservices.sh" "$install_dir/app/" + cp -a "$source_dir/server/start-server.sh" "$install_dir/app/" + cp -a "$source_dir/LICENSE" "$install_dir/app/" # Install custom start.sh script ynh_add_config --template="immich-server-start.sh" --destination="$install_dir/app/start.sh" chmod +x "$install_dir/app/start.sh" @@ -155,7 +155,7 @@ myynh_install_immich() { ynh_exec_warn_less "$ynh_npm" cache clean --force # Install immich-machine-learning - cd "$tmpdir/machine-learning" + cd "$source_dir/machine-learning" mkdir -p "$install_dir/app/machine-learning" $py_app_version -m venv "$install_dir/app/machine-learning/venv" ( @@ -170,8 +170,8 @@ myynh_install_immich() { # poetry install ynh_exec_warn_less "$install_dir/app/machine-learning/venv/bin/poetry" install --no-root --with dev --with cpu ) - cp -a "$tmpdir/machine-learning/ann" "$install_dir/app/machine-learning/" - cp -a "$tmpdir/machine-learning/app" "$install_dir/app/machine-learning/" + cp -a "$source_dir/machine-learning/ann" "$install_dir/app/machine-learning/" + cp -a "$source_dir/machine-learning/app" "$install_dir/app/machine-learning/" # Install custom start.sh script ynh_add_config --template="immich-machine-learning-start.sh" --destination="$install_dir/app/machine-learning/start.sh" chmod +x "$install_dir/app/machine-learning/start.sh" @@ -191,7 +191,7 @@ myynh_install_immich() { sed -i -e "s@app.listen(port)@app.listen(port, '127.0.0.1')@g" "$install_dir/app/dist/microservices/main.js" # Cleanup - ynh_secure_remove --file="$tmpdir" + ynh_secure_remove --file="$source_dir" # Install geonames wget --output-document="$install_dir/resources/cities500.zip" \ diff --git a/scripts/install b/scripts/install index 1014475..fb2a967 100755 --- a/scripts/install +++ b/scripts/install @@ -13,15 +13,15 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -tmpdir="$(mktemp --directory)" -ynh_setup_source --source_id="main" --dest_dir="$tmpdir" +source_dir="$install_dir/source" +ynh_setup_source --source_id="main" --dest_dir="$source_dir" #================================================= # CHECK PYTHON VERSION AND COMPILE IF NEEDED #================================================= ynh_script_progression --message="Check Python version & compile the required one if needed..." --weight=1 -py_required_major=$(cat "$tmpdir/machine-learning/Dockerfile" | grep "FROM python:" | head -n1 | cut -d':' -f2 | cut -d'-' -f1) +py_required_major=$(cat "$source_dir/machine-learning/Dockerfile" | grep "FROM python:" | head -n1 | cut -d':' -f2 | cut -d'-' -f1) myynh_py_latest_from_major --python="$py_required_major" myynh_install_python --python="$py_required_version" diff --git a/scripts/upgrade b/scripts/upgrade index f56396c..f123f98 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,8 +24,9 @@ ynh_systemd_action --service_name="$app-machine-learning" --action="stop" # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." --weight=1 -tmpdir="$(mktemp --directory)" -ynh_setup_source --source_id="main" --dest_dir="$tmpdir" + +source_dir="$install_dir/source" +ynh_setup_source --source_id="main" --dest_dir="$source_dir" #================================================= # CHECK PYTHON VERSION AND COMPILE IF NEEDED