mirror of
https://github.com/YunoHost-Apps/bozon_ynh.git
synced 2024-09-03 18:16:09 +02:00
51 lines
1.3 KiB
Bash
51 lines
1.3 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
|
|
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
|
sudo 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"
|
|
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
|
|
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
|
|
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"
|