From 7a5e59b9ed9b68dd78a759776a1eedc622f4fd04 Mon Sep 17 00:00:00 2001 From: DorianBDev Date: Tue, 15 Feb 2022 15:18:19 +0100 Subject: [PATCH] Fix issues with scripts - Change an "rm -rf" to "ynh_secure_remove" for the remove script. - Add the config file to the backup and restore scripts. - Fix incorrect "chmod" for the restore and upgrade scripts. - Fix missing "architecture" variable for the upgrade script. --- scripts/backup | 3 +++ scripts/remove | 2 +- scripts/restore | 14 ++++++++------ scripts/upgrade | 6 +++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4649990..f876c34 100644 --- a/scripts/backup +++ b/scripts/backup @@ -39,6 +39,9 @@ ynh_print_info --message="Declaring files to be backed up..." # Frontend ynh_backup --src_path="$final_path" +# Config +ynh_backup --src_path="/etc/vikunja/config.yml" + # Backend ynh_backup --src_path="/opt/vikunja" diff --git a/scripts/remove b/scripts/remove index 9fcba45..23189e4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -98,7 +98,7 @@ ynh_system_user_delete --username=$app ynh_script_progression --message="Removing backend..." --weight=1 # Delete /opt/vikunja -rm -rf "/opt/vikunja" +ynh_secure_remove --file="/opt/vikunja" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 8be991c..90f666b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -61,15 +61,17 @@ ynh_script_progression --message="Restoring $app main directory..." --weight=4 # Frontend ynh_restore_file --origin_path="$final_path" - -# Backend -ynh_restore_file --origin_path="/opt/vikunja" - -chmod +x "/opt/vikunja/vikunja" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chmod +x "$final_path/vikunja" + +# Config +ynh_restore_file --origin_path="/etc/vikunja/config.yml" + +# Backend +ynh_restore_file --origin_path="/opt/vikunja" +chmod +x "/opt/vikunja/vikunja" +chown -R $app:www-data "/opt/vikunja/files" #================================================= # REINSTALL DEPENDENCIES diff --git a/scripts/upgrade b/scripts/upgrade index 802fbab..8ad7751 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) +architecture=$YNH_ARCH set_motd=$(ynh_app_setting_get --app=$app --key=set_motd) enable_registration=$(ynh_app_setting_get --app=$app --key=enable_registration) @@ -113,12 +114,11 @@ then cp "$back" "/opt/vikunja/vikunja" fi -chmod +x "/opt/vikunja/vikunja" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chmod +x "$final_path/vikunja" -chown -R $app:www-data "$final_path/files" +chmod +x "/opt/vikunja/vikunja" +chown -R $app:www-data "/opt/vikunja/files" #================================================= # NGINX CONFIGURATION