2022-04-19 20:31:41 +02:00
#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2024-08-31 01:13:07 +02:00
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service="$app-chat" --action="stop"
ynh_systemctl --service="$app-clsi" --action="stop"
ynh_systemctl --service="$app-contacts" --action="stop"
ynh_systemctl --service="$app-docstore" --action="stop"
ynh_systemctl --service="$app-document-updater" --action="stop"
ynh_systemctl --service="$app-filestore" --action="stop"
ynh_systemctl --service="$app-history-v1" --action="stop"
ynh_systemctl --service="$app-notifications" --action="stop"
ynh_systemctl --service="$app-project-history" --action="stop"
ynh_systemctl --service="$app-real-time" --action="stop"
ynh_systemctl --service="$app-spelling" --action="stop"
ynh_systemctl --service="$app-web" --action="stop"
2022-04-19 20:31:41 +02:00
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
2024-08-31 01:13:07 +02:00
ynh_script_progression "Updating NGINX web server configuration..."
2022-04-19 20:31:41 +02:00
2024-08-31 01:13:07 +02:00
ynh_config_change_url_nginx
2023-11-19 16:41:50 +01:00
2022-04-19 20:31:41 +02:00
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
2022-04-23 19:59:10 +02:00
# UPDATE A CONFIG FILE
2022-04-19 20:31:41 +02:00
#=================================================
2024-08-31 01:13:07 +02:00
ynh_script_progression "Updating configuration..."
2023-11-19 17:01:44 +01:00
2022-04-23 19:59:10 +02:00
domain=$new_domain
2023-11-19 16:41:50 +01:00
path=$new_path
2022-04-23 19:59:10 +02:00
2024-08-31 01:13:07 +02:00
ynh_config_add --template="variables.env" --destination="$install_dir/variables.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/variables.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/variables.env"
2022-04-23 19:59:10 +02:00
2024-08-31 01:13:07 +02:00
ynh_config_add --template="settings.js" --destination="$install_dir/settings.js"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/settings.js"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/settings.js"
2022-04-19 20:31:41 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-08-31 01:13:07 +02:00
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --wait_until="Loading backend"
ynh_systemctl --service="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --wait_until="Using settings from"
ynh_systemctl --service="$app-web" --action="start" --log_path="/var/log/$app/web.log" --wait_until="listening on" --wait_until="Using settings from"
2022-04-19 20:31:41 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2024-08-31 01:13:07 +02:00
ynh_script_progression "Change of URL completed for $app"