Optimize upgrade: avoid to set premission on data dir to just call gitea command to generated keys

This commit is contained in:
Josué Tille 2024-02-07 12:06:46 +01:00
parent e096dda814
commit d836db84d1
No known key found for this signature in database
GPG Key ID: 5F259226AD51F2F5

View File

@ -55,12 +55,18 @@ fi
# Ensure secrets are defined # Ensure secrets are defined
ynh_setup_source --dest_dir="$install_dir" --source_id=main ynh_setup_source --dest_dir="$install_dir" --source_id=main
_set_permissions
#================================================= #=================================================
# MIGRATION STEP 2 (Set undefined Vars) # 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 if [[ -z "${internal_token:-}" ]]; then
internal_token=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN) 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" 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 # Configure gitea with app.ini file
ynh_add_config --template=app.ini --destination="$install_dir/custom/conf/app.ini" ynh_add_config --template=app.ini --destination="$install_dir/custom/conf/app.ini"
ynh_script_progression --message='Setting permissions...'
_set_permissions _set_permissions
# Update ldap config # Update ldap config