diff --git a/scripts/install b/scripts/install index 94f9a2f..2a13e58 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 76db4f9..70bdef5 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 #=================================================