2021-06-09 22:55:44 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2021-11-22 23:52:20 +01:00
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
2021-06-09 22:55:44 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
2021-11-22 23:52:20 +01:00
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
2021-06-09 22:55:44 +02:00
|
|
|
|
2023-03-23 23:13:14 +01:00
|
|
|
ynh_change_url_nginx_config
|
|
|
|
|
2021-06-09 22:55:44 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
# UPDATE CONFIGURATION FILE
|
|
|
|
#=================================================
|
|
|
|
|
2024-04-14 19:26:15 +02:00
|
|
|
# Add newline at end of file if required
|
|
|
|
if [ -e "$data_dir/config.xml" ]; then
|
|
|
|
sed -i -e '$a\' "$data_dir/config.xml"
|
|
|
|
fi
|
|
|
|
|
2023-03-23 23:29:06 +01:00
|
|
|
ynh_add_config --template="../conf/config.xml" --destination="$data_dir/config.xml"
|
2021-06-09 22:55:44 +02:00
|
|
|
|
2023-03-23 23:29:06 +01:00
|
|
|
chmod 750 "$data_dir/config.xml"
|
|
|
|
chmod o-rwx "$data_dir/config.xml"
|
|
|
|
chown $app "$data_dir/config.xml"
|
2021-06-09 22:55:44 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2021-11-22 23:52:20 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2021-06-09 22:55:44 +02:00
|
|
|
|
2023-03-22 01:22:53 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started"
|
2021-06-09 22:55:44 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-11-22 23:52:20 +01:00
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|