From bad51ca31e82a69ad22af450e981387afe9acb23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Nov 2023 19:21:02 +0100 Subject: [PATCH] cleaning --- scripts/install | 17 +++++------------ scripts/upgrade | 31 ++++++++++++------------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/scripts/install b/scripts/install index cfef0bc..74f98b5 100755 --- a/scripts/install +++ b/scripts/install @@ -22,13 +22,10 @@ email="$(ynh_user_get_info --username=$admin --key=mail)" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=api_secret --value=$api_secret ynh_app_setting_set --app=$app --key=app_key --value=$app_key ynh_app_setting_set --app=$app --key=phantomjs_key --value=$phantomjs_key -ynh_app_setting_set --app=$app --key=email_fullname --value="$email_fullname" -ynh_app_setting_set --app=$app --key=email --value=$email #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -37,6 +34,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --dest_dir="$install_dir" +chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= @@ -50,6 +48,10 @@ ynh_add_fpm_config # Create a dedicated nginx config ynh_add_nginx_config +ynh_add_config --template="cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + #================================================= # SPECIFIC SETUP #================================================= @@ -84,15 +86,6 @@ chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# ADD A CRON JOB -#================================================= -ynh_script_progression --message="Adding a cron job..." --weight=1 - -ynh_add_config --template="cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ef1ecab..bbed929 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,6 +15,18 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= + +# Delete deprecated `firstname`/`lastname` 'null' settings. See upstream https://github.com/YunoHost/yunohost/pull/1516 +ynh_app_setting_delete --app=$app --key=email_firstname +ynh_app_setting_delete --app=$app --key=email_lastname + +# Retrieve admin user settings +email_fullname="$(ynh_user_get_info --username=$admin --key=fullname)" +email="$(ynh_user_get_info --username=$admin --key=mail)" # include as admin's email address is also subject to change + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -45,25 +57,6 @@ ynh_add_config --template="cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" -#================================================= -# UPDATE APP SETTINGS -#================================================= - -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - # Delete deprecated `firstname`/`lastname` 'null' settings. See upstream https://github.com/YunoHost/yunohost/pull/1516 - ynh_app_setting_delete --app=$app --key=email_firstname - ynh_app_setting_delete --app=$app --key=email_lastname - - # Retrieve admin user settings - email_fullname="$(ynh_user_get_info --username=$admin --key=fullname)" - email="$(ynh_user_get_info --username=$admin --key=mail)" # include as admin's email address is also subject to change - - # Set - ynh_app_setting_set --app=$app --key=email_fullname --value="$email_fullname" - ynh_app_setting_set --app=$app --key=email --value=$email -fi - #================================================= # UPDATE A CONFIG FILE #=================================================