2024-03-03 12:24:48 +01:00
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
2024-03-03 16:48:07 +01:00
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
2024-03-03 12:24:48 +01:00
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2024-08-30 22:47:53 +02:00
ynh_script_progression "Stopping $app's systemd service..."
2024-03-03 12:24:48 +01:00
2024-08-30 22:47:53 +02:00
ynh_systemctl --service="$app.target" --action="stop"
2024-03-03 12:24:48 +01:00
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
2024-08-30 22:47:53 +02:00
ynh_script_progression "Updating NGINX web server configuration..."
2024-03-03 12:24:48 +01:00
# this will most likely adjust NGINX config correctly
2024-08-30 22:47:53 +02:00
ynh_config_change_url_nginx
2024-03-03 12:24:48 +01:00
#=================================================
# UPDATE A CONFIG FILE
#=================================================
2024-08-30 22:47:53 +02:00
ynh_script_progression "Updating configuration..."
2024-03-03 12:24:48 +01:00
2024-08-30 22:47:53 +02:00
ynh_config_add --template="diaspora.yml" --destination="$install_dir/live/config/diaspora.yml"
#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/live/config/diaspora.yml"
#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/live/config/diaspora.yml"
2024-03-03 12:24:48 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-08-30 22:47:53 +02:00
ynh_script_progression "Starting $app's systemd service..."
2024-03-03 12:24:48 +01:00
systemctl restart "${app}.target"
2024-08-30 22:47:53 +02:00
ynh_systemctl --service="${app}_web.service" --action=restart --log_path="$install_dir/live/log/production.log" --wait_until="successfully configured the federation library"
ynh_systemctl --service="${app}_sidekiq.service" --action=restart --log_path="systemd" --wait_until="Running in ruby"
2024-03-03 12:24:48 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2024-08-30 22:47:53 +02:00
ynh_script_progression "Change of URL completed for $app"