2017-04-08 00:06:50 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2022-05-28 01:29:55 +02:00
|
|
|
# GENERIC START
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2017-07-23 00:14:35 +02:00
|
|
|
|
2017-07-23 17:46:25 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
# REMOVE SYSTEM CONFIGURATIONS
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
# REMOVE SYSTEMD SERVICE
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
2018-05-04 11:47:06 +02:00
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|
|
|
then
|
2022-05-28 01:29:55 +02:00
|
|
|
ynh_script_progression --message="Removing $app service integration..." --weight=3
|
2020-07-18 11:46:45 +02:00
|
|
|
yunohost service remove $app
|
|
|
|
fi
|
2017-04-08 00:06:50 +02:00
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_remove_systemd_config
|
2017-04-08 00:06:50 +02:00
|
|
|
|
2019-01-05 20:42:54 +01:00
|
|
|
ynh_remove_nginx_config
|
2018-05-04 11:47:06 +02:00
|
|
|
|
2022-05-28 01:29:55 +02:00
|
|
|
ynh_remove_nodejs
|
|
|
|
|
2022-12-09 18:01:27 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE SANDBOX DOMAIN
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# We don't test that in CI
|
|
|
|
if ! [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
2023-02-09 15:43:33 +01:00
|
|
|
|
|
|
|
# if the main domain for the app is a root domain, we create a correct sandbox subdomain
|
|
|
|
if [[ $domain == *"."* ]]; then
|
|
|
|
sandboxdomain=sandbox.$domain
|
|
|
|
fi
|
|
|
|
# if the main domain for the app is already a sub-domain, we create a correct sandbox domain
|
|
|
|
if [[ $domain == *"."*"."* ]]; then
|
|
|
|
sandboxdomain=sandbox-$domain
|
|
|
|
fi
|
|
|
|
# if the main domain for the app is a .local root domain, we create a correct sandbox subdomain
|
|
|
|
if [[ $domain == *".local" ]]; then
|
|
|
|
sandboxdomain=sandbox-$domain
|
|
|
|
fi
|
|
|
|
|
2023-12-21 11:30:26 +01:00
|
|
|
ynh_script_progression --message="Removing sandbox domain: $sandboxdomain" --weight=1
|
2023-02-09 15:43:33 +01:00
|
|
|
|
2022-12-09 18:01:27 +01:00
|
|
|
if yunohost domain list | grep -q $sandboxdomain
|
2023-12-21 14:02:48 +01:00
|
|
|
then # if domain exist we remove it
|
2022-12-09 18:01:27 +01:00
|
|
|
yunohost domain remove $sandboxdomain
|
2023-12-21 14:02:48 +01:00
|
|
|
# we clean the NGINX configuration we added
|
2022-12-09 18:01:27 +01:00
|
|
|
ynh_secure_remove --file="/etc/nginx/conf.d/$sandboxdomain.d/"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# END OF SCRIPT
|
2018-05-04 11:47:06 +02:00
|
|
|
#=================================================
|
|
|
|
|
2021-09-19 08:33:36 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|