2022-12-27 17:59:56 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2023-01-02 19:03:27 +01:00
|
|
|
ynh_script_progression --message="Stopping systemd services..." --weight=1
|
2022-12-27 17:59:56 +01:00
|
|
|
|
2024-01-04 16:57:56 +01:00
|
|
|
for service_name in "${SERVICES_LIST[@]}"; do
|
2023-01-02 19:03:27 +01:00
|
|
|
ynh_systemd_action --service_name="${app}-${service_name}" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
|
|
done
|
2022-12-27 17:59:56 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
|
|
|
|
2024-01-03 23:19:38 +01:00
|
|
|
ynh_change_url_nginx_config
|
|
|
|
|
2022-12-27 17:59:56 +01:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC MODIFICATIONS
|
|
|
|
#=================================================
|
2023-01-02 19:03:27 +01:00
|
|
|
# Update document url in .env
|
2022-12-27 17:59:56 +01:00
|
|
|
#=================================================
|
2023-01-02 19:03:27 +01:00
|
|
|
ynh_script_progression --message="Updating .env configuration..."
|
|
|
|
|
2023-01-04 14:35:25 +01:00
|
|
|
new_document_url=$(append_uri "https://${new_domain}${new_path}" "docs")
|
2024-01-04 16:57:56 +01:00
|
|
|
ynh_app_setting_set --app="$app" --key=document_url --value="$new_document_url"
|
2023-01-02 19:03:27 +01:00
|
|
|
|
2024-01-03 23:19:38 +01:00
|
|
|
ynh_backup_if_checksum_is_different --file="$install_dir/.env"
|
|
|
|
ynh_replace_string --match_string="$document_url" --replace_string="$new_document_url" --target_file="$install_dir/.env"
|
|
|
|
ynh_store_file_checksum --file="$install_dir/.env"
|
2022-12-27 17:59:56 +01:00
|
|
|
|
2024-04-05 18:34:23 +02:00
|
|
|
# Update the repository pages
|
|
|
|
ynh_add_config --template="repository-next.json" --destination="$data_dir/repository-next.json"
|
|
|
|
ynh_add_config --template="repository-stable.json" --destination="$data_dir/repository-stable.json"
|
|
|
|
|
2022-12-27 17:59:56 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2023-01-02 19:03:27 +01:00
|
|
|
ynh_script_progression --message="Starting systemd services..." --weight=1
|
2022-12-27 17:59:56 +01:00
|
|
|
|
2024-01-04 16:57:56 +01:00
|
|
|
for service_name in "${SERVICES_LIST[@]}"; do
|
|
|
|
ynh_systemd_action --service_name="${app}-${service_name}" --action="start" --log_path="/var/log/$app/$app.log"
|
2023-01-02 19:03:27 +01:00
|
|
|
done
|
2022-12-27 17:59:56 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|