2017-01-08 12:17:57 +01:00
|
|
|
#!/bin/bash
|
2017-07-03 21:07:56 +02:00
|
|
|
# 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
|
2017-07-03 21:07:56 +02:00
|
|
|
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
|
2017-07-03 21:07:56 +02:00
|
|
|
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
|
|
|
|
2017-07-03 21:07:56 +02:00
|
|
|
# manage script failure
|
|
|
|
set -u
|
|
|
|
|
|
|
|
# retrieve arguments
|
2016-10-13 06:51:38 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2017-07-03 21:07:56 +02:00
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2016-03-23 19:30:43 +01:00
|
|
|
|
2017-07-03 21:07:56 +02: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
|
2017-07-03 21:07:56 +02:00
|
|
|
ynh_app_setting_set "$app" backup_core_only 0
|
|
|
|
app_bck=${app//_/-}
|
2019-11-18 12:30:42 +01:00
|
|
|
yunohost backup create --ignore-system --apps "$app" --name "${app_bck}_$(date '+%Y%m%d-%H%M%S')"
|
2017-07-03 21:07:56 +02:00
|
|
|
echo "BoZon fully backuped." >&2
|
2016-05-23 21:40:55 +02:00
|
|
|
fi
|
2016-04-06 19:29:59 +02:00
|
|
|
|
2017-07-03 21:07:56 +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
|
2017-07-03 21:07:56 +02:00
|
|
|
|
|
|
|
# remove the dedicated php-fpm config
|
2017-09-22 19:33:28 +02:00
|
|
|
ynh_remove_fpm_config
|
2017-07-03 21:07:56 +02:00
|
|
|
|
|
|
|
# remove a directory securely
|
|
|
|
ynh_secure_remove "$data_path"
|
|
|
|
|
|
|
|
# delete a system user
|
|
|
|
ynh_system_user_delete "$app"
|