From 96e1905ad711f7cfe90b3673fbbc9ac474c2ba36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:39:36 +0200 Subject: [PATCH] cleaning --- scripts/backup | 22 +++++----------------- scripts/remove | 5 ++--- scripts/restore | 4 ++-- scripts/upgrade | 16 +++------------- 4 files changed, 12 insertions(+), 35 deletions(-) diff --git a/scripts/backup b/scripts/backup index d45b6dc..a8196c4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -21,18 +21,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" -#================================================= -# BACKUP THE NGINX CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP DATA_DIR DIRECTORY #================================================= @@ -40,15 +28,15 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="$data_dir" --is_big #================================================= -# BACKUP BINARY +# SYSTEM CONFIGURATION #================================================= +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +ynh_backup --src_path="/etc/logrotate.d/$app" + ynh_backup --src_path="/usr/bin/$app" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= diff --git a/scripts/remove b/scripts/remove index 9434ca3..17c3382 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,9 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEM CONFIGURATIONS #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null diff --git a/scripts/restore b/scripts/restore index 2dccb71..d1a23dc 100755 --- a/scripts/restore +++ b/scripts/restore @@ -58,12 +58,12 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 45bdbce..126e5fd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -25,14 +19,10 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=7 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=7 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="config.js" -fi +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" --keep="config.js" #================================================= # UPGRADE NODEJS