2023-01-05 14:48:22 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
2023-01-11 10:32:49 +01:00
|
|
|
# GENERIC STARTING
|
2023-01-05 14:48:22 +01:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
2023-01-11 10:32:49 +01:00
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
2023-01-05 14:48:22 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
2023-01-11 10:32:49 +01:00
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=2
|
2023-01-05 14:48:22 +01:00
|
|
|
|
2023-01-11 10:32:49 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/forgejo.log"
|
2023-01-05 14:48:22 +01:00
|
|
|
|
2023-01-11 10:32:49 +01:00
|
|
|
#=================================================
|
2023-01-05 14:48:22 +01:00
|
|
|
# MODIFY URL IN NGINX CONF
|
2023-01-11 10:32:49 +01:00
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3
|
|
|
|
|
2023-03-10 17:13:54 +01:00
|
|
|
ynh_change_url_nginx_config
|
|
|
|
|
2023-01-11 10:32:49 +01:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
2023-03-10 17:13:54 +01:00
|
|
|
#REMOVEME?
|
2023-01-11 10:32:49 +01:00
|
|
|
domain=$new_domain
|
2023-03-10 17:13:54 +01:00
|
|
|
path=$new_path
|
2023-01-11 10:32:49 +01:00
|
|
|
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
|
2023-01-05 14:48:22 +01:00
|
|
|
|
2023-03-10 17:13:54 +01:00
|
|
|
ynh_exec_warn_less ynh_add_config --template="../conf/app.ini" --destination="$install_dir/custom/conf/app.ini"
|
2023-01-05 14:48:22 +01:00
|
|
|
|
2023-03-10 17:13:54 +01:00
|
|
|
chmod 640 "$install_dir/custom/conf/app.ini"
|
|
|
|
chown $app:$app "$install_dir/custom/conf/app.ini"
|
2023-01-05 14:48:22 +01:00
|
|
|
|
2023-01-11 10:32:49 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
|
|
|
|
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/forgejo.log" --line_match="Starting new Web server: tcp:127.0.0.1:"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2023-01-05 14:48:22 +01:00
|
|
|
|
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|