From d0ee68531a59cf246e19c12baa9be06113aece95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 1 Oct 2024 07:43:31 +0200 Subject: [PATCH] cleaning --- doc/ADMIN_fr.md | 2 ++ manifest.toml | 2 +- scripts/backup | 17 +---------------- scripts/install | 13 ++----------- scripts/remove | 14 +------------- scripts/restore | 6 ------ scripts/upgrade | 12 ++---------- 7 files changed, 9 insertions(+), 57 deletions(-) create mode 100644 doc/ADMIN_fr.md diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md new file mode 100644 index 0000000..5411d51 --- /dev/null +++ b/doc/ADMIN_fr.md @@ -0,0 +1,2 @@ +- Cette application nécessite une post-installation manuelle +- Nous pourrions préconfigurer les notifications par courrier électronique avec le serveur de messagerie YunoHost en guise d'amélioration. Voir les commentaires dans le fichier pour essayer de le faire avec Curl et WebSockets ou Sqlite. \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index ed3725c..f78f0ed 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ userdoc = "https://github.com/louislam/uptime-kuma/wiki" code = "https://github.com/louislam/uptime-kuma" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.30" helpers_version = "2.1" architectures = "all" multi_instance = true diff --git a/scripts/backup b/scripts/backup index 7f4ab25..07811df 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,6 +1,5 @@ #!/bin/bash -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,29 +12,15 @@ ynh_print_info "Declaring files to be backed up..." ynh_backup "$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - ynh_backup "/etc/logrotate.d/$app" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup "/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - ynh_backup "/var/log/$app/" #================================================= diff --git a/scripts/install b/scripts/install index bbcab2c..611c289 100755 --- a/scripts/install +++ b/scripts/install @@ -15,26 +15,19 @@ ynh_nodejs_install #================================================= ynh_script_progression "Setting up source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -# Download, check integrity, uncompress and patch the source from dist.src ynh_setup_source --dest_dir="$install_dir/dist" --source_id="dist" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression "Adding system configurations related to $app..." -# Create a dedicated NGINX config ynh_config_add_nginx -# Create a dedicated systemd config ynh_config_add_systemd -# Use logrotate to manage application logfile(s) ynh_config_add_logrotate yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$app.log" @@ -45,9 +38,8 @@ yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$ ynh_script_progression "Installing $app dependencies..." pushd "$install_dir" - -ynh_hide_warnings ynh_exec_as_app node_load_PATH npm install --omit=dev -ynh_hide_warnings ynh_exec_as_app node_load_PATH npm run download-dist + ynh_hide_warnings ynh_exec_as_app npm install --omit=dev + ynh_hide_warnings ynh_exec_as_app npm run download-dist popd #================================================= @@ -55,7 +47,6 @@ popd #================================================= ynh_script_progression "Integrating service in YunoHost..." -# Start a systemd service ynh_systemctl --service=$app --action="start" #================================================= diff --git a/scripts/remove b/scripts/remove index a23001e..64627e6 100755 --- a/scripts/remove +++ b/scripts/remove @@ -5,33 +5,21 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS -#================================================= -# REMOVE SYSTEMD SERVICE - #================================================= ynh_script_progression "Removing system configurations related to $app..." -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_hide_warnings yunohost service status $app >/dev/null -then - ynh_script_progression "Removing $app service integration..." +if ynh_hide_warnings yunohost service status $app >/dev/null; then yunohost service remove $app fi -# Remove the dedicated systemd config ynh_config_remove_systemd -# Remove the app-specific logrotate config ynh_config_remove_logrotate ynh_nodejs_remove -# Remove the dedicated NGINX config ynh_config_remove_nginx -# Remove the log files -#REMOVEME? (Apps should not remove their log dir during remove ... this should only happen if --purge is used, and be handled by the core...) ynh_safe_rm "/var/log/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index e271d5f..d2693ae 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,6 +1,5 @@ #!/bin/bash -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -11,21 +10,16 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= ynh_script_progression "Reinstalling dependencies..." -# Define and install dependencies ynh_nodejs_install #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= ynh_script_progression "Restoring system configurations related to $app..." ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index 3022e13..4b317ed 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,14 +15,10 @@ ynh_systemctl --service=$app --action="stop" #================================================= ynh_script_progression "Upgrading source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -# Download, check integrity, uncompress and patch the source from dist.src ynh_setup_source --dest_dir="$install_dir/dist" --source_id="dist" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= @@ -30,13 +26,10 @@ ynh_script_progression "Upgrading system configurations related to $app..." ynh_nodejs_install -# Create a dedicated NGINX config ynh_config_add_nginx -# Create a dedicated systemd config ynh_config_add_systemd -# Use logrotate to manage app-specific logfile(s) ynh_config_add_logrotate yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$app.log" @@ -45,9 +38,8 @@ yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$ ynh_script_progression "Upgrading $app dependencies..." pushd "$install_dir" - - ynh_hide_warnings ynh_exec_as_app node_load_PATH npm install --omit=dev - ynh_hide_warnings ynh_exec_as_app node_load_PATH npm run download-dist + ynh_hide_warnings ynh_exec_as_app npm install --omit=dev + ynh_hide_warnings ynh_exec_as_app npm run download-dist # Residue of old versions caching ynh_safe_rm $install_dir/.cache popd