From aae2e19b942eaa19076a44d5a64d52e933c8f39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:18:31 +0200 Subject: [PATCH] cleaning --- scripts/backup | 45 --------------------------------------------- scripts/change_url | 14 +++++++++----- scripts/install | 2 +- scripts/upgrade | 2 +- 4 files changed, 11 insertions(+), 52 deletions(-) diff --git a/scripts/backup b/scripts/backup index 010f6c5..a07766f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,51 +15,18 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fills the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls take basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= ynh_backup --src_path="$install_dir" -#================================================= -# BACKUP THE DATA DIR -#================================================= - -# Only relevant if there is a "data_dir" resource for this app -ynh_backup --src_path="$data_dir" --is_big - #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP THE PHP-FPM CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -#================================================= -# BACKUP FAIL2BAN CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" - -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= @@ -72,18 +39,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/cron.d/$app" -ynh_backup --src_path="/etc/$app/" - -#================================================= -# BACKUP THE MYSQL DATABASE -#================================================= -ynh_print_info --message="Backing up the MySQL database..." - -### (However, things like MySQL dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - -ynh_mysql_dump_db --database="$db_name" > db.sql - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index f0964a6..e14a009 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -26,10 +26,14 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config #================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... +# ADD A CONFIGURATION #================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template=".env" --destination="$install_dir/.env.local" + +chmod 400 "$install_dir/.env.local" +chown $app:$app "$install_dir/.env.local" #================================================= # GENERIC FINALISATION @@ -38,7 +42,7 @@ ynh_change_url_nginx_config #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 0e0624b..b6529a2 100755 --- a/scripts/install +++ b/scripts/install @@ -52,7 +52,7 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="WebUI for BorgBackup" --log="/var/log/$app/$app.log" #================================================= # APP INITIAL CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index b028cd7..d769a70 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ ynh_add_nginx_config ynh_add_systemd_config -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="WebUI for BorgBackup" --log="/var/log/$app/$app.log" #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)