From cd046117a5b300ba67faf4d6b25bb1c44fb774d2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 15 May 2019 12:18:39 +0200 Subject: example_ynh corrections --- scripts/upgrade | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'scripts/upgrade') diff --git a/scripts/upgrade b/scripts/upgrade index 7562d85..1d35159 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,6 +37,12 @@ otp_secret=$(ynh_app_setting_get --app=$app --key=otp_secret) vapid_private_key=$(ynh_app_setting_get --app=$app --key=vapid_private_key) vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key) +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -140,19 +146,23 @@ ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=sy #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=14 -# Download Mastodon -mv "$final_path/live" "$final_path/live_back" -ynh_setup_source --dest_dir="$final_path/live" -if [ -z $final_path/live_back/public/system ]; then - rsync -a "$final_path/live_back/public/system" "$final_path/live_back/public/." +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --weight=14 + + # Download Mastodon + mv "$final_path/live" "$final_path/live_back" + ynh_setup_source --dest_dir="$final_path/live" + if [ -z $final_path/live_back/public/system ]; then + rsync -a "$final_path/live_back/public/system" "$final_path/live_back/public/." + fi + rsync -a "$final_path/live_back/.env.production" "$final_path/live/." + rm -Rf "$final_path/live_back" + + # Clean files which are not needed anymore + ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb" fi -rsync -a "$final_path/live_back/.env.production" "$final_path/live/." -rm -Rf "$final_path/live_back" - -# Clean files which are not needed anymore -ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb" #================================================= # NGINX CONFIGURATION -- cgit v1.2.3-70-g09d2