From f8885b35441d6b2b127b84e8ba945dc7055d0744 Mon Sep 17 00:00:00 2001 From: anmol Date: Mon, 9 Nov 2020 18:23:45 +0530 Subject: [PATCH] Added ynh_add_systemd_config for adding datadir and fs_port --- scripts/change_url | 6 +----- scripts/install | 3 ++- scripts/restore | 3 ++- scripts/upgrade | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index d0ef915..cc6c0e4 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,9 +28,6 @@ ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -fs_port=$(ynh_app_setting_get --app=$app --key=fs_port) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) # Add settings here as needed by your application #db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -120,8 +117,7 @@ fi # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description "$app service" --others_var="$fs_port $datadir" --log "$datadir/log/debug-last.log" --needs_exposed_ports "$fs_port" +ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="/etc/systemd/system/${app}.service" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/install b/scripts/install index 12e1395..0aa9771 100755 --- a/scripts/install +++ b/scripts/install @@ -190,8 +190,9 @@ ynh_script_progression --message="Integrating service in YunoHost..." ### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script ### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script ### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script +ynh_add_systemd_config --service="$app" --template="systemd.service" --others_var="$fs_port $datadir" -yunohost service add $app --description "$app service" --others_var="$fs_port $datadir" --log "$datadir/log/debug-last.log" --needs_exposed_ports "$fs_port" +yunohost service add $app --description "$app service" --log "$datadir/log/debug-last.log" --needs_exposed_ports "$fs_port" ### Additional options starting with 3.8: ### diff --git a/scripts/restore b/scripts/restore index d4afe49..06c7079 100755 --- a/scripts/restore +++ b/scripts/restore @@ -101,7 +101,8 @@ systemctl enable $app.service #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app service" --others_var="$fs_port $datadir" --log "$datadir/log/debug-last.log" --needs_exposed_ports "$fs_port" +ynh_add_systemd_config --service="$app" --template="systemd.service" --others_var="$fs_port $datadir" +yunohost service add $app --description "$app service" --log "$datadir/log/debug-last.log" --needs_exposed_ports "$fs_port" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 54891e5..c9d52d6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -140,8 +140,8 @@ chown -R $app: $datadir # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description "$app service" --others_var="$fs_port $datadir" --log "$datadir/log/debug-last.log" --needs_exposed_ports "$fs_port" +ynh_add_systemd_config --service="$app" --template="systemd.service" --others_var="$fs_port $datadir" +yunohost service add $app --description "$app service" --log "$datadir/log/debug-last.log" --needs_exposed_ports "$fs_port" #================================================= # START SYSTEMD SERVICE