1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mobilizon_ynh.git synced 2024-09-03 19:46:19 +02:00

Fix upgrade steps

This commit is contained in:
yalh76 2019-06-22 09:07:19 +02:00
parent c173ad82f9
commit a841258586

View file

@ -71,6 +71,7 @@ ynh_print_info --message="Backing up the app before upgrading (may take a while)
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
read -p "key"
# restore it if the upgrade fails # restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
ynh_clean_check_starting ynh_clean_check_starting
@ -94,9 +95,26 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --time --weight=1 ynh_script_progression --message="Upgrading source files..." --time --weight=1
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir
cp -a "$final_path/$app/.env" "$tmpdir/.env"
cp -a "$final_path/$app/config/prod.exs" "$tmpdir/prod.exs"
# Remove the app directory securely
ynh_secure_remove --file="$final_path/$app"
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/$app" ynh_setup_source --dest_dir="$final_path/$app"
#Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/.env" "$final_path/$app/.env"
cp -a "$tmpdir/prod.exs" "$final_path/$app/config/prod.exs"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
fi fi
#================================================= #=================================================