From 74fc9ed43e8fa531ddba45eb3a4741b71d46ba16 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 22 Dec 2020 20:36:44 +0100 Subject: [PATCH 1/4] Please add --quiet to systemctl enable/disable commands to avoid unecessary warnings when the script runs --- scripts/restore | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 6d438b7..181cda8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -91,7 +91,7 @@ chown -R "$app": "$sync_home" ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service +systemctl enable $app.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index 511612e..be04a9b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,7 +71,7 @@ if [ -z $gui_port ]; then systemctl stop syncthing@$OLD_SYNCUSER.service yunohost service remove syncthing@$OLD_SYNCUSER.service - systemctl disable syncthing@$OLD_SYNCUSER.service + systemctl disable syncthing@$OLD_SYNCUSER.service --quiet ynh_secure_remove --file="/etc/apt/sources.list.d/syncthing.list" From 9de72d9d848fa76c7f1d29842d262708826f6221 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 22 Dec 2020 20:38:01 +0100 Subject: [PATCH 2/4] We recommend to *not* use 'ynh_script_progression' in backup scripts --- scripts/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index b77b5e3..ccef97b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -59,7 +59,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= # BACKUP THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Backing up data directory..." +ynh_print_info --message="Backing up data directory..." ynh_backup --src_path="$sync_home" --is_big From 8fedbed7d201cdd069c8cde77c86dd03a17782c8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 22 Dec 2020 20:38:45 +0100 Subject: [PATCH 3/4] Using option '--log_type systemd' with 'yunohost service add' is not relevant anymore --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 75c0984..e1d9ec5 100644 --- a/scripts/install +++ b/scripts/install @@ -162,7 +162,7 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" --log_type "systemd" +yunohost service add $app --description "$app daemon for Syncthing" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index 181cda8..bbb0233 100644 --- a/scripts/restore +++ b/scripts/restore @@ -98,7 +98,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" --log_type "systemd" +yunohost service add $app --description "$app daemon for Syncthing" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index be04a9b..00a379a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -180,7 +180,7 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" --log_type "systemd" +yunohost service add $app --description "$app daemon for Syncthing" #================================================= # GENERIC FINALIZATION From bb2dfbc96e995a65dd81f8c6295e9fbd8373e172 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 22 Dec 2020 20:43:30 +0100 Subject: [PATCH 4/4] The install script expose a port on the outside with 'yunohost firewall allow' but doesn't use 'yunohost service add' with --needs_exposed_ports ... --- scripts/install | 2 +- scripts/restore | 11 ++++++++++- scripts/upgrade | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index e1d9ec5..10a1496 100644 --- a/scripts/install +++ b/scripts/install @@ -162,7 +162,7 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" +yunohost service add $app --description "$app daemon for Syncthing" --needs_exposed_ports $sync_port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index bbb0233..b51c5ca 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,6 +31,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) sync_home=$(ynh_app_setting_get --app=$app --key=sync_home) +sync_port=$(ynh_app_setting_get --app=$app --key=sync_port) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -44,6 +45,14 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS +#================================================= +# OPEN A PORT +#================================================= +ynh_script_progression --message="Configuring firewall..." + +# Open the port +ynh_exec_warn_less yunohost firewall allow TCP $sync_port + #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= @@ -98,7 +107,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" +yunohost service add $app --description "$app daemon for Syncthing" --needs_exposed_ports $sync_port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 00a379a..96ad24e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -180,7 +180,7 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Syncthing" +yunohost service add $app --description "$app daemon for Syncthing" --needs_exposed_ports $sync_port #================================================= # GENERIC FINALIZATION