2017-02-07 22:55:13 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-04-01 16:53:29 +02:00
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -u
|
|
|
|
|
2017-05-13 17:15:51 +02:00
|
|
|
if [ ! -e .fonctions ]; then
|
|
|
|
# Get file fonction if not been to the current directory
|
|
|
|
sudo cp ../settings/scripts/.fonctions ./.fonctions
|
|
|
|
sudo chmod a+rx .fonctions
|
|
|
|
fi
|
2017-04-03 13:02:08 +02:00
|
|
|
source .fonctions # Loads the generic functions usually used in the script
|
2017-04-01 16:53:29 +02:00
|
|
|
source /usr/share/yunohost/helpers # Source app helpers
|
2017-02-07 22:55:13 +01:00
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
# Get multi-instances specific variables
|
2017-02-07 22:55:13 +01:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
# Stop lufi service
|
2017-02-07 22:55:13 +01:00
|
|
|
if [ -e "/etc/systemd/system/lufi.service" ]; then
|
|
|
|
echo "Delete systemd script"
|
|
|
|
sudo service lufi stop
|
|
|
|
sudo rm "/etc/systemd/system/lufi.service"
|
|
|
|
sudo systemctl disable lufi.service
|
|
|
|
fi
|
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
# Remove monitoring service Yunohost.
|
2017-02-07 22:55:13 +01:00
|
|
|
if sudo yunohost service status | grep -q lufi # Test l'existence du service dans Yunohost
|
|
|
|
then
|
|
|
|
echo "Remove lufi service"
|
|
|
|
sudo yunohost service remove lufi
|
|
|
|
fi
|
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
SECURE_REMOVE '/var/www/$app' # Delete directory application
|
2017-02-07 22:55:13 +01:00
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
REMOVE_NGINX_CONF # Delete nginx configuration
|
2017-02-07 22:55:13 +01:00
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
# Delete cron
|
2017-02-07 22:55:13 +01:00
|
|
|
if [ -e "/etc/cron.d/$app" ]; then
|
|
|
|
echo "Delete cron"
|
|
|
|
sudo rm "/etc/cron.d/$app"
|
|
|
|
fi
|
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
SECURE_REMOVE '/var/log/$app/' # Delete log
|
2017-02-07 22:55:13 +01:00
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
REMOVE_LOGROTATE_CONF # Delete logrotate configuration
|
2017-02-07 22:55:13 +01:00
|
|
|
|
2017-04-03 14:04:18 +02:00
|
|
|
ynh_package_remove build-essential || echo "build-essential already uninstalled"
|
2017-04-01 16:53:29 +02:00
|
|
|
|
2017-04-03 13:02:08 +02:00
|
|
|
# Reload SSOwat configuration
|
2017-02-07 22:55:13 +01:00
|
|
|
sudo yunohost app ssowatconf
|
|
|
|
|
|
|
|
echo -e "\e[0m" # Restore normal color
|