Skip to content

Commit

Permalink
We actually don't really care about the update_type because we might …
Browse files Browse the repository at this point in the history
…want to *always* rebuild the app.
  • Loading branch information
Salamandar committed Mar 31, 2024
1 parent 4180e2f commit d0b76fc
Showing 1 changed file with 26 additions and 37 deletions.
63 changes: 26 additions & 37 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
source _common.sh
source /usr/share/yunohost/helpers

#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)

#=================================================
# STOP SYSTEMD SERVICE
#=================================================
Expand All @@ -26,38 +21,32 @@ ynh_systemd_action --service_name="$app-machine-learning" --action="stop"
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1

#=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
#=================================================
# 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"

#=================================================
# 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)
myynh_py_latest_from_major --python="$py_required_major"
myynh_install_python --python="$py_required_version"

#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing nodejs..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"

#=================================================
# MAKE INSTALL
#=================================================
ynh_script_progression --message="Making install..." --weight=5
ynh_secure_remove --file="$install_dir"
myynh_install_immich
fi
# 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"

#=================================================
# 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)
myynh_py_latest_from_major --python="$py_required_major"
myynh_install_python --python="$py_required_version"

#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing nodejs..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"

#=================================================
# MAKE INSTALL
#=================================================
ynh_script_progression --message="Making install..." --weight=5
ynh_secure_remove --file="$install_dir"
myynh_install_immich

#=================================================
# UPDATE A CONFIG FILE
Expand Down

0 comments on commit d0b76fc

Please sign in to comment.