diff --git a/scripts/upgrade b/scripts/upgrade index a46f4f7..27ff9ff 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) etherpad_instance=$(ynh_app_setting_get --app=$app --key=etherpad_instance) creation_open=$(ynh_app_setting_get --app=$app --key=creation_open) +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -35,20 +41,32 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # STANDARD UPGRADE STEPS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=5 -# Download, check integrity, uncompress and patch the source from app.src -pushd "$final_path" - git checkout master - git pull --quiet - git checkout $COMMIT --quiet - git submodule update --init --recursive --quiet -popd +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --weight=5 + + # Download, check integrity, uncompress and patch the source from app.src + pushd "$final_path" + git checkout master + git pull --quiet + git checkout $COMMIT --quiet + git submodule update --init --recursive --quiet + popd +fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -62,14 +80,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #=================================================