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

51 lines
1.3 KiB
Text
Raw Normal View History

#!/bin/bash
# to test the functionnality :
# yunohost app remove bozon
2016-03-23 19:30:43 +01:00
if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo 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"
nginx_conf="/etc/nginx/conf.d/$domain.d/$app.conf"
phpfpm_conf="/etc/php5/fpm/pool.d/$app.conf"
# create a full backup (core+datas) if app installed
if [ $(sudo yunohost app list -i -f "$app" | wc -l) -gt 1 ]; then
ynh_app_setting_set "$app" backup_core_only 0
app_bck=${app//_/-}
sudo yunohost backup create --ignore-system --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
myynh_remove_nginx_config
# remove the dedicated php-fpm config
myynh_remove_fpm_config
# remove a directory securely
ynh_secure_remove "$data_path"
# delete a system user
ynh_system_user_delete "$app"