From 5458d10b165490751305e268c5ca06d70842a5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 14 Mar 2023 09:01:57 +0100 Subject: [PATCH] Cleaning --- scripts/install | 18 +++++------------- scripts/remove | 10 ---------- scripts/restore | 15 ++------------- 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/scripts/install b/scripts/install index a702a31..7a295e8 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ enable_public_boards="false" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=5 ynh_app_setting_set --app=$app --key=enable_public_boards --value=$enable_public_boards @@ -37,27 +36,20 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=3 - # Create a dedicated systemd config ynh_add_systemd_config +yunohost service add $app --description="Self-hosted kanban board" --log="/var/log/$app/$app.log" + #================================================= # ADD A CONFIGURATION #================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" + chmod 600 $install_dir/config.json - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=4 - -yunohost service add $app --description="Self-hosted kanban board" --log="/var/log/$app/$app.log" +chown $app:$app "$install_dir/config.json" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index 733649f..2e81091 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,19 +22,9 @@ 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 NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 0052700..f20ed4f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,14 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -49,14 +41,11 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Self-hosted kanban board" --log="/var/log/$app/$app.log" #=================================================