From dba44f012d96fcfe81093a92088deafae77b614f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 6 Apr 2021 01:17:48 +0200 Subject: [PATCH] Better service name --- scripts/backup | 6 +++--- scripts/install | 6 +++--- scripts/remove | 30 +++++++++++++++--------------- scripts/restore | 12 ++++++------ scripts/upgrade | 12 ++++++------ 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/scripts/backup b/scripts/backup index 7f94b15..e163c5e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -69,9 +69,9 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/$app-beat.service" -ynh_backup --src_path="/etc/systemd/system/$app-server.service" -ynh_backup --src_path="/etc/systemd/system/$app-worker.service" +ynh_backup --src_path="/etc/systemd/system/${app}-beat.service" +ynh_backup --src_path="/etc/systemd/system/${app}-server.service" +ynh_backup --src_path="/etc/systemd/system/${app}-worker.service" ynh_backup --src_path="/etc/systemd/system/$app.target" #================================================= diff --git a/scripts/install b/scripts/install index 10170fb..2f845c1 100644 --- a/scripts/install +++ b/scripts/install @@ -179,9 +179,9 @@ ynh_script_progression --message="Configuring a systemd service..." ynh_add_config --template="../conf/funkwhale.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-server" --template="funkwhale-server.service" --others_var="datadir" -ynh_add_systemd_config --service="$app-worker" --template="funkwhale-worker.service" --others_var="datadir" -ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.service" --others_var="datadir" +ynh_add_systemd_config --service="${app}-server" --template="funkwhale-server.service" --others_var="datadir" +ynh_add_systemd_config --service="${app}-worker" --template="funkwhale-worker.service" --others_var="datadir" +ynh_add_systemd_config --service="${app}-beat" --template="funkwhale-beat.service" --others_var="datadir" #================================================= # GENERIC FINALIZATION diff --git a/scripts/remove b/scripts/remove index 35e1da4..5ad36aa 100644 --- a/scripts/remove +++ b/scripts/remove @@ -30,22 +30,22 @@ redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status "$app-server" >/dev/null +if ynh_exec_warn_less yunohost service status "${app}-server" >/dev/null then - ynh_script_progression --message="Removing $app-server service integration..." - yunohost service remove "$app-server" + ynh_script_progression --message="Removing ${app}-server service integration..." + yunohost service remove "${app}-server" fi -if ynh_exec_warn_less yunohost service status "$app-worker" >/dev/null +if ynh_exec_warn_less yunohost service status "${app}-worker" >/dev/null then - ynh_script_progression --message="Removing $app-worker service integration..." - yunohost service remove "$app-worker" + ynh_script_progression --message="Removing ${app}-worker service integration..." + yunohost service remove "${app}-worker" fi -if ynh_exec_warn_less yunohost service status "$app-beat" >/dev/null +if ynh_exec_warn_less yunohost service status "${app}-beat" >/dev/null then - ynh_script_progression --message="Removing $app-beat service integration..." - yunohost service remove "$app-beat" + ynh_script_progression --message="Removing ${app}-beat service integration..." + yunohost service remove "${app}-beat" fi #================================================= @@ -53,14 +53,14 @@ fi #================================================= ynh_script_progression --message="Stopping and removing the systemd service..." -ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="systemd" --line_match="Stopped Funkwhale" -ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped Funkwhale" -ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped Funkwhale" +ynh_systemd_action --service_name="${app}-beat" --action="stop" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --service_name="${app}-server" --action="stop" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --service_name="${app}-worker" --action="stop" --log_path="systemd" --line_match="Stopped $app" # Remove the dedicated systemd config -ynh_remove_systemd_config --service="$app-server" -ynh_remove_systemd_config --service="$app-worker" -ynh_remove_systemd_config --service="$app-beat" +ynh_remove_systemd_config --service="${app}-beat" +ynh_remove_systemd_config --service="${app}-server" +ynh_remove_systemd_config --service="${app}-worker" ynh_secure_remove --file="/etc/systemd/system/$app.target" diff --git a/scripts/restore b/scripts/restore index 2b9d772..78c0386 100644 --- a/scripts/restore +++ b/scripts/restore @@ -118,14 +118,14 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= ynh_script_progression --message="Restoring the systemd configuration..." -ynh_restore_file --origin_path="/etc/systemd/system/$app-beat.service" -ynh_restore_file --origin_path="/etc/systemd/system/$app-server.service" -ynh_restore_file --origin_path="/etc/systemd/system/$app-worker.service" +ynh_restore_file --origin_path="/etc/systemd/system/${app}-beat.service" +ynh_restore_file --origin_path="/etc/systemd/system/${app}-server.service" +ynh_restore_file --origin_path="/etc/systemd/system/${app}-worker.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.target" -systemctl enable "$app-beat.service" --quiet -systemctl enable "$app-server.service" --quiet -systemctl enable "$app-worker.service" --quiet +systemctl enable "${app}-beat.service" --quiet +systemctl enable "${app}-server.service" --quiet +systemctl enable "${app}-worker.service" --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index e63d02e..8e20777 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -75,9 +75,9 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="systemd" --line_match="Stopped Funkwhale" -ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped Funkwhale" -ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped Funkwhale" +ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped $app" #================================================= # MOVE DATAS @@ -208,9 +208,9 @@ ynh_script_progression --message="Upgrading systemd configuration..." ynh_add_config --template="../conf/funkwhale.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-server" --template="funkwhale-server.service" --others_var="datadir" -ynh_add_systemd_config --service="$app-worker" --template="funkwhale-worker.service" --others_var="datadir" -ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.service" --others_var="datadir" +ynh_add_systemd_config --service="${app}-server" --template="funkwhale-server.service" --others_var="datadir" +ynh_add_systemd_config --service="${app}-worker" --template="funkwhale-worker.service" --others_var="datadir" +ynh_add_systemd_config --service="${app}-beat" --template="funkwhale-beat.service" --others_var="datadir" #================================================= # GENERIC FINALIZATION