2021-01-17 19:41:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=4
|
|
|
|
|
2023-09-11 21:36:20 +02:00
|
|
|
ynh_systemd_action --service_name=$app --action=stop --log_path="systemd"
|
2021-01-17 19:41:16 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
|
|
|
|
2023-09-11 21:36:20 +02:00
|
|
|
ynh_change_url_nginx_config
|
2021-01-17 19:41:16 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# EDIT MATTERMOST CONFIG
|
|
|
|
#=================================================
|
|
|
|
# MODIFY A CONFIG FILE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Modifying a config file..." --weight=3
|
|
|
|
|
|
|
|
# Main config File
|
2023-09-11 21:36:20 +02:00
|
|
|
ynh_replace_string --match_string="\"SiteURL\": \".*\"" --replace_string="\"SiteURL\": \"https://${new_domain}${new_path}\"" --target_file="$install_dir/config/config.json"
|
|
|
|
ynh_replace_string --match_string="\"FeedbackEmail\": \".*\"" --replace_string="\"FeedbackEmail\": \"no-reply@${new_domain}\"" --target_file="$install_dir/config/config.json"
|
2021-01-17 19:41:16 +01:00
|
|
|
|
2023-09-11 21:36:20 +02:00
|
|
|
ynh_store_file_checksum --file="$install_dir/config/config.json"
|
2021-01-17 19:41:16 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
|
|
|
|
|
|
|
# Start a systemd service
|
2021-03-17 20:59:57 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Mattermost"
|
2021-01-17 19:41:16 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|