From d836db84d111c0cd6e9a92dee54b2f02a97b73e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 7 Feb 2024 12:06:46 +0100 Subject: [PATCH] Optimize upgrade: avoid to set premission on data dir to just call gitea command to generated keys --- scripts/upgrade | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 4512cc2..3200a9b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,12 +55,18 @@ fi # Ensure secrets are defined ynh_setup_source --dest_dir="$install_dir" --source_id=main -_set_permissions #================================================= # MIGRATION STEP 2 (Set undefined Vars) #================================================= +ynh_script_progression --message='Migrating missing settings...' + +# Must set permission before to call gitea command +chown -R "$app:$app" "$install_dir" +chmod -R u=rwX,g=rX,o= "$install_dir" +chmod +x "$install_dir/gitea" + if [[ -z "${internal_token:-}" ]]; then internal_token=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN) ynh_app_setting_set --app "$app" --key internal_token --value="$internal_token" @@ -106,6 +112,8 @@ ynh_secure_remove --file="$install_dir/templates" # Configure gitea with app.ini file ynh_add_config --template=app.ini --destination="$install_dir/custom/conf/app.ini" + +ynh_script_progression --message='Setting permissions...' _set_permissions # Update ldap config