From 705db615ebf4bee667dc3094f4cce9c5977d5cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 23 May 2023 10:11:31 +0200 Subject: [PATCH] cleaning --- manifest.toml | 3 ++- scripts/backup | 2 +- scripts/install | 3 --- scripts/remove | 35 +++-------------------------------- scripts/restore | 5 +---- scripts/upgrade | 34 +++++++--------------------------- 6 files changed, 14 insertions(+), 68 deletions(-) diff --git a/manifest.toml b/manifest.toml index 021372f..6d4643a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,7 +16,7 @@ admindoc = "https://wiki.servarr.com/Lidarr" code = "https://github.com/Lidarr/Lidarr" [integration] -yunohost = ">= 11.1.15" +yunohost = ">= 11.1.19" architectures = "all" multi_instance = true ldap = false @@ -60,6 +60,7 @@ ram.runtime = "50M" [resources.install_dir] [resources.data_dir] + subdirs = ["logs"] [resources.permissions] main.url = "/" diff --git a/scripts/backup b/scripts/backup index a23cf70..c8931d8 100755 --- a/scripts/backup +++ b/scripts/backup @@ -25,7 +25,7 @@ ynh_backup --src_path="$install_dir" # BACKUP THE APP DATA DIR #================================================= -ynh_backup --src_path="$data_dir" +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index 14a058b..c77eef5 100755 --- a/scripts/install +++ b/scripts/install @@ -17,9 +17,6 @@ ynh_script_progression --message="Setting up source files..." --weight=3 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -mkdir -p "$data_dir/logs" - -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" diff --git a/scripts/remove b/scripts/remove index 272e743..d9cee11 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE +# REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +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 @@ -22,45 +23,15 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE APP DATA DIR -#================================================= -ynh_script_progression --message="Removing app data directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$data_dir" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --weight=1 - # Remove the log files ynh_secure_remove --file="/var/log/$app" diff --git a/scripts/restore b/scripts/restore index de453e4..279c476 100755 --- a/scripts/restore +++ b/scripts/restore @@ -26,7 +26,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" @@ -35,10 +34,8 @@ chown -R $app: "$install_dir" #================================================= ynh_script_progression --message="Restoring the app data directory..." --weight=2 -ynh_restore_file --origin_path="$data_dir" +ynh_restore_file --origin_path="$data_dir" --not_mandatory -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" chown -R $app: "$data_dir" chmod 400 "$data_dir/config.xml" diff --git a/scripts/upgrade b/scripts/upgrade index e7bf5c9..568b324 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,28 +36,25 @@ then ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC UPGRADE -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 - # Create a dedicated systemd config ynh_add_systemd_config +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append --logfile="$data_dir/logs" + +yunohost service add $app --description="Lidarr daemon" --log="$data_dir/logs/lidarr.txt" + #================================================= # UPDATE A CONFIG FILE #================================================= @@ -68,23 +65,6 @@ ynh_add_config --template="../conf/config.xml" --destination="$data_dir/config.x chmod 400 "$data_dir/config.xml" chown $app:$app "$data_dir/config.xml" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append --logfile="$data_dir/logs" - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Lidarr daemon" --log="$data_dir/logs/lidarr.txt" - #================================================= # START SYSTEMD SERVICE #=================================================