1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minetest_ynh.git synced 2024-09-03 20:36:00 +02:00
minetest_ynh/scripts/change_url
2019-10-23 15:23:05 +02:00

69 lines
2 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
new_domain=$YNH_APP_NEW_DOMAIN
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
#=================================================
# STANDARD MODIFICATIONS
#=================================================
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
ynh_print_info --message="Stop Minetest..."
systemctl stop $app
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="/home/yunohost.app/$app/.minetest/minetest.conf"
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD MINETEST
#=================================================
ynh_print_info --message="Reloading Minetest..."
systemctl restart $app
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Change of URL completed for $app"