1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/diacamma_ynh.git synced 2024-09-03 18:26:10 +02:00
diacamma_ynh/scripts/change_url
2023-12-16 16:45:14 +01:00

56 lines
No EOL
1.9 KiB
Bash

#!/bin/bash
# This is the tutorial version of the app.
# It contains extra commands to explain what should be done in case you want to adjust some part of the script.
# Once you are done, you may remove them.
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
pushd $install_dir
ynh_add_config --template="../conf/extra_diacamma.json" --destination="/tmp/extra.json"
if [ "$path" == "/" ]
then
sed -i "/USE_X_FORWARDED_HOST/d" /tmp/extra.json
sed -i "/FORCE_SCRIPT_NAME/d" /tmp/extra.json
fi
extra_json=$(jq -c . /tmp/extra.json)
venv/bin/lucterios_admin.py modif -n inst-${app} -e ''$extra_json''
popd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last