1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cops_ynh.git synced 2024-09-03 18:25:57 +02:00
cops_ynh/scripts/remove
2017-02-24 18:20:15 +00:00

52 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
#set -eu
# Charge les fonctions génériques habituellement utilisées dans le script
source .fonctions
# Active trap pour arrêter le script si une erreur est détectée.
#TRAP_ON
# Source app helpers
source /usr/share/yunohost/helpers
# We retrieve app parameters
app=$YNH_APP_INSTANCE_NAME
# We check variables are not empty
CHECK_VAR "$app" "app name not set"
path=$(ynh_app_setting_get $app path)
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path)
finalnginxconf=$(ynh_app_setting_get $app finalnginxconf)
finalphpconf=$(ynh_app_setting_get $app finalphpconf)
runninguser=$app-ynh
# Suppression du dossier de la webapp
SECURE_REMOVE '$final_path'
# Suppression de la config nginx de la webapp
if [ -e "$finalnginxconf" ]; then # Delete nginx config
echo "Delete nginx config"
sudo rm $finalnginxconf
fi
if [ -e "$finalphpconf" ]; then # Delete nginx config
echo "Delete php-fpm config"
sudo rm $finalphpconf
fi
# Remove app dependencies
if ynh_package_is_installed "cops-deps"; then
ynh_package_autoremove "cops-deps"
fi
# Remove the user account
id "$runninguser" >/dev/null 2>&1 \
&& sudo deluser --quiet "$runninguser" >/dev/null
# We reload the services
sudo service php5-fpm reload
sudo service nginx reload
sudo yunohost app ssowatconf