diff --git a/scripts/upgrade b/scripts/upgrade index b45c092..440d42f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,35 +32,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 - -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - - mkdir -p $final_path - - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -91,26 +62,25 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=160 - -# Create a temporary directory -tmpdir="$(mktemp -d)" + # Create a temporary directory + tmpdir="$(mktemp -d)" -# Backup the config file in the temp dir -cp -a "$final_path/config.json" "$tmpdir/config.json" -cp -a "$final_path/.sequelizerc" "$tmpdir/.sequelizerc" + # Backup the config file in the temp dir + cp -a "$final_path/config.json" "$tmpdir/config.json" + cp -a "$final_path/.sequelizerc" "$tmpdir/.sequelizerc" -# Remove the app directory securely -ynh_secure_remove --file="$final_path" + # Remove the app directory securely + ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" -#Copy the admin saved settings from tmp directory to final path -cp -a "$tmpdir/config.json" "$final_path/config.json" -cp -a "$tmpdir/.sequelizerc" "$final_path/.sequelizerc" + #Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/config.json" "$final_path/config.json" + cp -a "$tmpdir/.sequelizerc" "$final_path/.sequelizerc" -# Remove the tmp directory securely -ynh_secure_remove --file="$tmpdir" + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi