diff --git a/scripts/backup b/scripts/backup index fdee95f..62ac387 100644 --- a/scripts/backup +++ b/scripts/backup @@ -61,7 +61,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Backing up the PostgreSQL database..." --weight=4 -ynh_psql_dump_db "$db_name" > db.sql +ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # SPECIFIC BACKUP diff --git a/scripts/change_url b/scripts/change_url index 24b21fc..9d88f37 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -33,7 +33,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_name=$(ynh_app_setting_get --app=$app --key=db_name) #db_user=$db_name #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) -admin_mail=$(ynh_app_setting_get --app=$app --key=admin_mail) #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED diff --git a/scripts/install b/scripts/install index 2742e1d..396fd76 100644 --- a/scripts/install +++ b/scripts/install @@ -77,8 +77,8 @@ ynh_app_setting_set --app=$app --key=language --value=$language ynh_script_progression --message="Configuring firewall..." --weight=1 # Find a free port -port_web=$(ynh_find_port 3000) -port_stream=$(ynh_find_port 4000) +port_web=$(ynh_find_port --port=3000) +port_stream=$(ynh_find_port --port=4000) # Open this port ynh_app_setting_set --app=$app --key=port_web --value=$port_web ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream @@ -230,7 +230,7 @@ ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming ynh_script_progression --message="Storing the config file checksum..." --weight=1 # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "${final_path}/live/.env.production" +ynh_store_file_checksum --file="${final_path}/live/.env.production" #================================================= # GENERIC FINALIZATION diff --git a/scripts/remove b/scripts/remove index bd6c9c6..d5a3a55 100644 --- a/scripts/remove +++ b/scripts/remove @@ -54,9 +54,9 @@ fi ynh_script_progression --message="Stopping and removing the systemd service..." --weight=27 # Remove the dedicated systemd config -ynh_remove_systemd_config "$app-web" -ynh_remove_systemd_config "$app-sidekiq" -ynh_remove_systemd_config "$app-streaming" +ynh_remove_systemd_config --service="$app-web" +ynh_remove_systemd_config --service="$app-sidekiq" +ynh_remove_systemd_config --service="$app-streaming" #================================================= # REMOVE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 93cb3f0..0de06df 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 #================================================= @@ -143,19 +149,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