mirror of
https://github.com/YunoHost-Apps/bozon_ynh.git
synced 2024-09-03 18:16:09 +02:00
49 lines
1.2 KiB
Bash
49 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# to test the functionnality :
|
|
# yunohost app remove bozon
|
|
|
|
set -u
|
|
if [ ! -e _common.sh ]; then
|
|
# Get the _common.sh file if it's not in the current directory
|
|
cp ../settings/scripts/_common.sh ./_common.sh
|
|
chmod a+rx _common.sh
|
|
fi
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# manage script failure
|
|
set -u
|
|
|
|
# retrieve arguments
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
# definie useful vars
|
|
final_path="/var/www/$app"
|
|
data_path="/home/yunohost.app/$app"
|
|
|
|
# create a full backup (core+datas) if app installed
|
|
if [ $(yunohost app list -i -f "$app" | wc -l) -gt 1 ]; then
|
|
ynh_app_setting_set "$app" backup_core_only 0
|
|
app_bck=${app//_/-}
|
|
yunohost backup create --ignore-system --apps "$app" --name "${app_bck}_$(date '+%Y%m%d-%H%M%S')"
|
|
echo "BoZon fully backuped." >&2
|
|
fi
|
|
|
|
# remove metapackage and its dependencies
|
|
ynh_remove_app_dependencies
|
|
|
|
# remove the app directory securely
|
|
ynh_secure_remove "$final_path"
|
|
|
|
# remove the dedicated nginx config
|
|
ynh_remove_nginx_config
|
|
|
|
# remove the dedicated php-fpm config
|
|
ynh_remove_fpm_config
|
|
|
|
# remove a directory securely
|
|
ynh_secure_remove "$data_path"
|
|
|
|
# delete a system user
|
|
ynh_system_user_delete "$app"
|