2016-08-13 01:08:44 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Détruit les conteneurs lxc de demo.
|
|
|
|
# Permet de repartir sur des bases saines avec le script demo_lxc_build.sh
|
|
|
|
|
|
|
|
# Récupère le dossier du script
|
2016-09-18 19:23:54 +02:00
|
|
|
if [ "${0:0:1}" == "/" ]; then script_dir="$(dirname "$0")"; else script_dir="$(echo $PWD/$(dirname "$0" | cut -d '.' -f2) | sed 's@/$@@')"; fi
|
2016-08-13 01:08:44 +02:00
|
|
|
|
2022-10-13 05:46:46 +02:00
|
|
|
source $script_dir/ynh_lxd
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
app=${__APP__:-yunohost_demo}
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
|
|
lxc_name1=$(ynh_app_setting_get --app=$app --key=lxc_name1)
|
|
|
|
lxc_name2=$(ynh_app_setting_get --app=$app --key=lxc_name2)
|
|
|
|
lxdbr_demo_network=$(ynh_app_setting_get --app=$app --key=lxdbr_demo_network)
|
|
|
|
lxc_ip1=$(ynh_app_setting_get --app=$app --key=lxc_ip1)
|
|
|
|
lxc_ip2=$(ynh_app_setting_get --app=$app --key=lxc_ip2)
|
|
|
|
|
|
|
|
/bin/bash "$final_path/demo_stop.sh" -f
|
|
|
|
|
2022-10-14 05:02:08 +02:00
|
|
|
ynh_print_info --message="> Suppression des conteneurs et de leur snapshots"
|
2022-10-13 05:46:46 +02:00
|
|
|
ynh_secure_remove --file="/var/lib/lxd/snapshots/$lxc_name1/snap0.tar.gz"
|
|
|
|
ynh_lxc_delete --name=$lxc_name1
|
|
|
|
ynh_secure_remove --file="/var/lib/lxd/snapshots/$lxc_name2/snap0.tar.gz"
|
|
|
|
ynh_lxc_delete --name=$lxc_name2
|
|
|
|
|
2022-10-14 05:02:08 +02:00
|
|
|
ynh_print_info --message="> Suppression des crons"
|
2022-10-13 05:46:46 +02:00
|
|
|
ynh_secure_remove --file=/etc/cron.d/demo_switch
|
|
|
|
ynh_secure_remove --file=/etc/cron.d/demo_upgrade
|
|
|
|
|
2022-10-14 05:02:08 +02:00
|
|
|
ynh_print_info --message="> Suppression du service"
|
2022-10-13 05:46:46 +02:00
|
|
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|
|
|
then
|
|
|
|
ynh_print_info --message="Removing $app service integration..."
|
|
|
|
yunohost service remove $app
|
2016-09-18 19:23:54 +02:00
|
|
|
fi
|
2022-10-13 05:46:46 +02:00
|
|
|
ynh_print_info --message="Stopping and removing the systemd service..."
|
|
|
|
ynh_remove_systemd_config
|