#!/bin/bash #================================================= # GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # STANDARD MODIFICATIONS #================================================= # STOP SUPERVISOR SERVICE #================================================= ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 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..." --weight=1 ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS #================================================= # UPDATE CONFIG FILE #================================================= ynh_script_progression --message="Updating config file..." --weight=1 config="$install_dir/.env" ynh_backup_if_checksum_is_different --file="$config" ynh_replace_string --match_string="APP_URL=.*" --replace_string="APP_URL=https://$new_domain" --target_file="$config" ynh_replace_string --match_string="ADMIN_DOMAIN=.*" --replace_string="ADMIN_DOMAIN=\"$new_domain\"" --target_file="$config" ynh_replace_string --match_string="APP_DOMAIN=.*" --replace_string="APP_DOMAIN=\"$new_domain\"" --target_file="$config" ynh_replace_string --match_string="MAIL_FROM_ADDRESS=.*" --replace_string="MAIL_FROM_ADDRESS=\"pixelfed@$new_domain\"" --target_file="$config" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" #================================================= # APPLY CHANGES #================================================= ynh_script_progression --message="Applying changes..." --weight=1 pushd "$install_dir" php$phpversion artisan config:clear php$phpversion artisan config:cache php$phpversion artisan route:clear php$phpversion artisan route:cache php$phpversion artisan horizon:purge popd #================================================= # GENERIC FINALISATION #================================================= # START SUPERVISOR SERVICE #================================================= ynh_script_progression --message="Starting $app's systemd service..." --weight=1 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