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

50 lines
1.2 KiB
Text
Raw Normal View History

#!/bin/bash
# to test the functionnality :
# yunohost app remove bozon
2016-03-23 19:30:43 +01:00
2017-07-26 21:32:00 +02:00
set -u
if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
2017-09-22 19:55:09 +02:00
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
2016-10-13 06:51:38 +02:00
source /usr/share/yunohost/helpers
2016-05-23 21:40:55 +02:00
# manage script failure
set -u
# retrieve arguments
2016-10-13 06:51:38 +02:00
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain)
2016-03-23 19:30:43 +01:00
# definie useful vars
final_path="/var/www/$app"
data_path="/home/yunohost.app/$app"
# create a full backup (core+datas) if app installed
2017-09-22 19:55:09 +02:00
if [ $(yunohost app list -i -f "$app" | wc -l) -gt 1 ]; then
ynh_app_setting_set "$app" backup_core_only 0
app_bck=${app//_/-}
2019-11-18 15:48:14 +01:00
yunohost backup create --apps "$app" --name "${app_bck}_$(date '+%Y%m%d-%H%M%S')"
echo "BoZon fully backuped." >&2
2016-05-23 21:40:55 +02:00
fi
2016-04-06 19:29:59 +02:00
# remove metapackage and its dependencies
ynh_remove_app_dependencies
# remove the app directory securely
ynh_secure_remove "$final_path"
# remove the dedicated nginx config
2017-09-22 19:33:28 +02:00
ynh_remove_nginx_config
# remove the dedicated php-fpm config
2017-09-22 19:33:28 +02:00
ynh_remove_fpm_config
# remove a directory securely
ynh_secure_remove "$data_path"
# delete a system user
ynh_system_user_delete "$app"