From 46c2785f5cd09d0aff8d0bfa295f04c2c3e5e171 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 26 Aug 2021 00:47:16 +0200 Subject: [PATCH] Trying to fix bullseye --- check_process | 4 ++-- scripts/install | 15 +++++++++++++-- scripts/remove | 9 +++++++++ scripts/restore | 13 ++++++++++++- scripts/upgrade | 19 ++++++++++++++++++- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/check_process b/check_process index 816c1b1..55cb156 100644 --- a/check_process +++ b/check_process @@ -1,7 +1,7 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - admin="john" (USER) + domain="domain.tld" + admin="john" ; Checks pkg_linter=1 setup_sub_dir=0 diff --git a/scripts/install b/scripts/install index a158774..7926ba2 100755 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -65,6 +68,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # SPECIFIC SETUP @@ -99,6 +103,14 @@ ynh_add_config --template="../conf/biboumi.cfg" --destination="/etc/$app/$app.cf chown -R _biboumi:_biboumi "/etc/$app/$app.cfg" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." + +# Create a dedicated systemd config +systemctl enable $app.service --quiet + #================================================= # GENERIC FINALIZATION #================================================= @@ -125,8 +137,7 @@ yunohost service add $app --description="XMPP gateway for the IRC network" --log ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -sleep 5 -ynh_systemd_action --service_name=$app --action="restart" +ynh_systemd_action --service_name=$app --action="start" --line_match="Started Biboumi" --log_path="systemd" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 9914596..929ad48 100755 --- a/scripts/remove +++ b/scripts/remove @@ -29,6 +29,15 @@ then yunohost service remove $app fi +#================================================= +# STOP AND REMOVE SERVICE +#================================================= +ynh_script_progression --message="Stopping and removing the systemd service..." + +# Remove the dedicated systemd config +ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" +systemctl disable $app.service --quiet + #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 2ea9712..6d93fc1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -45,6 +48,7 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # RESTORE VARIOUS FILES @@ -61,6 +65,13 @@ ynh_restore_file --origin_path="/etc/metronome/conf.d/$app.cfg.lua" chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" ynh_systemd_action --service_name=metronome --action="restart" +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." + +systemctl enable $app.service --quiet + #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= @@ -83,7 +94,7 @@ yunohost service add $app --description="XMPP gateway for the IRC network" --log #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="restart" +ynh_systemd_action --service_name=$app --action="start" --line_match="Started Biboumi" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 6845241..6bb1980 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,6 +37,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Restore it if the upgrade fails ynh_restore_upgradebackup } @@ -45,6 +46,13 @@ ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -69,6 +77,7 @@ fi ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # SPECIFIC UPGRADE @@ -103,6 +112,14 @@ ynh_add_config --template="../conf/biboumi.cfg" --destination="/etc/$app/$app.cf chown -R _biboumi:_biboumi "/etc/$app/$app.cfg" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." + +# Create a dedicated systemd config +systemctl enable $app.service --quiet + #================================================= # GENERIC FINALIZATION #================================================= @@ -128,7 +145,7 @@ yunohost service add $app --description="XMPP gateway for the IRC network" --log #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --action=restart --service_name=$app +ynh_systemd_action --service_name=$app --action="start" --line_match="Started Biboumi" --log_path="systemd" #================================================= # END OF SCRIPT