1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/baikal_ynh.git synced 2024-09-03 18:16:11 +02:00
baikal_ynh/scripts/change_url
eric_G ce6d8a8eca
Version 2 (#79)
* v2

* v2

* fix

* Update manifest.toml

* fix

* Auto-update README

* fix

* Auto-update README

* Update manifest.toml

* Update manifest.toml

* Update manifest.toml

* Update upgrade

* cleaning

* Update manifest.toml

* Update upgrade

* Auto-update README

* Update manifest.toml

* Auto-update README

* Update install

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2023-09-29 08:54:00 +02:00

51 lines
1.8 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK IF THE APP CAN BE MOVED WITH THESE ARGS
#=================================================
if [ $change_domain -eq 1 ]
then
# Check if .well-known is available for the new domain.
if is_url_handled --domain="$new_domain" --path="/.well-known/caldav" || is_url_handled --domain="$new_domain" --path="/.well-known/carddav"
then
ynh_die --message="Another app already uses the domain $new_domain to serve a calDAV/cardDAV feature. Please use another domain."
fi
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# UPDATE CONFIGURATION
#=================================================
ynh_script_progression --message="Updating $app configuration..." --weight=2
ynh_backup_if_checksum_is_different --file="$install_dir/config/baikal.yaml"
ynh_replace_string --match_string="base_uri: '$old_path'" --replace_string="base_uri: '$new_path'" --target_file="$install_dir/config/baikal.yaml"
ynh_store_file_checksum --file="$install_dir/config/baikal.yaml"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last