#!/bin/bash #================================================= # GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # STANDARD MODIFICATIONS #================================================= # STOP SYSTEMD SERVICE #================================================= ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" #================================================= # MODIFY URL IN NGINX CONF #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS #================================================= # MODIFY A CONFIG FILE #================================================= ynh_print_info --message="Modifying config file..." config="$install_dir/.env" ynh_backup_if_checksum_is_different --file="$config" # Change the URL in the configuration file if [ "$new_path" == "/" ] then new_domain_uri="$new_domain" else new_domain_uri="$new_domain$new_path" fi ynh_replace_string --match_string="EXTERNAL_URL=.*" --replace_string="EXTERNAL_URL=https://$new_domain_uri/" --target_file="$config" #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= ynh_print_info --message="Storing the config file checksum..." # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" #================================================= # GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started" if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then sleep 60 fi #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Change of URL completed for $app"