1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cryptpad_ynh.git synced 2024-09-03 18:26:14 +02:00
cryptpad_ynh/scripts/remove

69 lines
2.2 KiB
Text
Raw Normal View History

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
#=================================================
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-12-04 11:33:12 +01:00
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
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
yunohost service remove $app
fi
2017-04-08 00:06:50 +02:00
# Remove the dedicated systemd config
ynh_remove_systemd_config
2017-04-08 00:06:50 +02:00
2020-10-13 13:52:56 +02:00
# Remove the dedicated NGINX config
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
#=================================================
# 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
2024-05-24 14:08:03 +02:00
ynh_script_progression --message="Removing sandbox domain: $sandboxdomain" --weight=1
2023-02-09 15:43:33 +01:00
if yunohost domain list | grep -q $sandboxdomain
then #if domain exist we remove it
yunohost domain remove $sandboxdomain
# we clean the nginx configuration we added
ynh_secure_remove --file="/etc/nginx/conf.d/$sandboxdomain.d/"
fi
fi
2018-05-04 11:47:06 +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