From 1f158212aef26e06d9517e8aa2aebbf0748bf108 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 9 Apr 2019 00:46:52 +0200 Subject: [PATCH] Implement change_url --- scripts/change_url | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 7b500d3..0d5709a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -7,6 +7,7 @@ #================================================= source _common.sh +source ynh_systemd_action source /usr/share/yunohost/helpers #================================================= @@ -17,7 +18,7 @@ old_domain=$YNH_APP_OLD_DOMAIN old_path=$YNH_APP_OLD_PATH new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +new_path="/" app=$YNH_APP_INSTANCE_NAME @@ -83,9 +84,33 @@ fi #================================================= # SPECIFIC MODIFICATIONS #================================================= -# ... +# STOP SERVICE #================================================= +ynh_systemd_action --action=stop --service_name=$app + +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +ynh_replace_string "$old_domain" "$new_domain" "$final_path/$app/.env" +ynh_replace_string "$old_domain" "$new_domain" "$final_path/$app/config/prod.secret.exs" + +#================================================= +# START SERVICE +#================================================= + +ynh_systemd_action --action=start --service_name=$app --log_path=systemd +#--line_match="Running Pleroma.Web.Endpoint" + +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= + +ynh_backup_if_checksum_is_different "$final_path/$app/.env" +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum "$final_path/$app/.env" + #================================================= # GENERIC FINALISATION #=================================================