1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/immich_ynh.git synced 2024-09-03 20:36:24 +02:00

Replace tmpdir with source_dir=install_dir/source because /tmp might be too small for sources. We can't be sure.

This commit is contained in:
Salamandar 2024-04-01 00:21:38 +02:00
parent d0b76fc53f
commit 36dce13106
3 changed files with 23 additions and 22 deletions

View file

@ -124,30 +124,30 @@ myynh_install_immich() {
ynh_use_nodejs ynh_use_nodejs
# Install immich-server # Install immich-server
cd "$tmpdir/server" cd "$source_dir/server"
ynh_exec_warn_less "$ynh_npm" ci ynh_exec_warn_less "$ynh_npm" ci
ynh_exec_warn_less "$ynh_npm" run build ynh_exec_warn_less "$ynh_npm" run build
ynh_exec_warn_less "$ynh_npm" prune --omit=dev --omit=optional 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" ci
ynh_exec_warn_less "$ynh_npm" run build 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" ci
ynh_exec_warn_less "$ynh_npm" run build ynh_exec_warn_less "$ynh_npm" run build
mkdir -p "$install_dir/app/" mkdir -p "$install_dir/app/"
cp -a "$tmpdir/server/node_modules" "$install_dir/app/" cp -a "$source_dir/server/node_modules" "$install_dir/app/"
cp -a "$tmpdir/server/dist" "$install_dir/app/" cp -a "$source_dir/server/dist" "$install_dir/app/"
cp -a "$tmpdir/server/bin" "$install_dir/app/" cp -a "$source_dir/server/bin" "$install_dir/app/"
cp -a "$tmpdir/web/build" "$install_dir/app/www" cp -a "$source_dir/web/build" "$install_dir/app/www"
cp -a "$tmpdir/server/resources" "$install_dir/app/" cp -a "$source_dir/server/resources" "$install_dir/app/"
cp -a "$tmpdir/server/package.json" "$install_dir/app/" cp -a "$source_dir/server/package.json" "$install_dir/app/"
cp -a "$tmpdir/server/package-lock.json" "$install_dir/app/" cp -a "$source_dir/server/package-lock.json" "$install_dir/app/"
cp -a "$tmpdir/server/start-microservices.sh" "$install_dir/app/" cp -a "$source_dir/server/start-microservices.sh" "$install_dir/app/"
cp -a "$tmpdir/server/start-server.sh" "$install_dir/app/" cp -a "$source_dir/server/start-server.sh" "$install_dir/app/"
cp -a "$tmpdir/LICENSE" "$install_dir/app/" cp -a "$source_dir/LICENSE" "$install_dir/app/"
# Install custom start.sh script # Install custom start.sh script
ynh_add_config --template="immich-server-start.sh" --destination="$install_dir/app/start.sh" ynh_add_config --template="immich-server-start.sh" --destination="$install_dir/app/start.sh"
chmod +x "$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 ynh_exec_warn_less "$ynh_npm" cache clean --force
# Install immich-machine-learning # Install immich-machine-learning
cd "$tmpdir/machine-learning" cd "$source_dir/machine-learning"
mkdir -p "$install_dir/app/machine-learning" mkdir -p "$install_dir/app/machine-learning"
$py_app_version -m venv "$install_dir/app/machine-learning/venv" $py_app_version -m venv "$install_dir/app/machine-learning/venv"
( (
@ -170,8 +170,8 @@ myynh_install_immich() {
# poetry install # poetry install
ynh_exec_warn_less "$install_dir/app/machine-learning/venv/bin/poetry" install --no-root --with dev --with cpu 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 "$source_dir/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/app" "$install_dir/app/machine-learning/"
# Install custom start.sh script # Install custom start.sh script
ynh_add_config --template="immich-machine-learning-start.sh" --destination="$install_dir/app/machine-learning/start.sh" 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" 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" sed -i -e "s@app.listen(port)@app.listen(port, '127.0.0.1')@g" "$install_dir/app/dist/microservices/main.js"
# Cleanup # Cleanup
ynh_secure_remove --file="$tmpdir" ynh_secure_remove --file="$source_dir"
# Install geonames # Install geonames
wget --output-document="$install_dir/resources/cities500.zip" \ wget --output-document="$install_dir/resources/cities500.zip" \

View file

@ -13,15 +13,15 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
tmpdir="$(mktemp --directory)" source_dir="$install_dir/source"
ynh_setup_source --source_id="main" --dest_dir="$tmpdir" ynh_setup_source --source_id="main" --dest_dir="$source_dir"
#================================================= #=================================================
# CHECK PYTHON VERSION AND COMPILE IF NEEDED # CHECK PYTHON VERSION AND COMPILE IF NEEDED
#================================================= #=================================================
ynh_script_progression --message="Check Python version & compile the required one if needed..." --weight=1 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_py_latest_from_major --python="$py_required_major"
myynh_install_python --python="$py_required_version" myynh_install_python --python="$py_required_version"

View file

@ -24,8 +24,9 @@ ynh_systemd_action --service_name="$app-machine-learning" --action="stop"
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1 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 # CHECK PYTHON VERSION AND COMPILE IF NEEDED