From 7c3062a765f282e70eba7d7a23802fbbf54ae4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 10 Jun 2024 23:29:20 +0200 Subject: [PATCH] Apply breaking changes documented at https://github.com/glitch-soc/mastodon/issues/2525 --- scripts/install | 1 + scripts/upgrade | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/scripts/install b/scripts/install index 4bb0e0a..0aa7387 100644 --- a/scripts/install +++ b/scripts/install @@ -132,6 +132,7 @@ pushd "$install_dir/live" # This export might be removed in yunohost 12 COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn install echo "SAFETY_ASSURED=1">> "$config" + ynh_exec_warn_less ynh_exec_as "$app" RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 "$ynh_ruby_load_path" "$ld_preload" bin/bundle exec rails db:encryption:init ynh_exec_warn_less ynh_exec_as "$app" RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 "$ynh_ruby_load_path" "$ld_preload" bin/bundle exec rails db:migrate --quiet ynh_exec_warn_less ynh_exec_as "$app" RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 "$ynh_ruby_load_path" "$ld_preload" bin/bundle exec rails assets:precompile --quiet # Generate vapid keys diff --git a/scripts/upgrade b/scripts/upgrade index 7cd5c97..6a36d68 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,20 +10,6 @@ source /usr/share/yunohost/helpers config="$install_dir/live/.env.production" -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# Set `service` settings to support `yunohost app shell` command -if [[ -z "${service:-}" ]]; then - service="$app-web.service" - ynh_app_setting_set --app="$app" --key=service --value="$service" -fi - -#Remove previous added repository -ynh_remove_extra_repo - #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -40,6 +26,24 @@ if [[ $db_name = *'_production' ]]; then ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# Set `service` settings to support `yunohost app shell` command +if [[ -z "${service:-}" ]]; then + service="$app-web.service" + ynh_app_setting_set --app="$app" --key=service --value="$service" +fi + +#Remove previous added repository +ynh_remove_extra_repo + +if ynh_compare_current_package_version --comparison lt --version 2024.05.01~ynh1; then + ynh_exec_warn_less ynh_exec_as "$app" RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 "$ynh_ruby_load_path" "$ld_preload" bin/bundle exec rails db:encryption:init +fi + #================================================= # ADD SWAP IF NEEDED #=================================================