1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lufi_ynh.git synced 2024-09-03 19:36:28 +02:00
lufi_ynh/scripts/remove
2017-05-13 17:15:51 +02:00

53 lines
1.4 KiB
Bash

#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -u
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
source .fonctions # Loads the generic functions usually used in the script
source /usr/share/yunohost/helpers # Source app helpers
# Get multi-instances specific variables
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
# Stop lufi service
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
# Remove monitoring service Yunohost.
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
SECURE_REMOVE '/var/www/$app' # Delete directory application
REMOVE_NGINX_CONF # Delete nginx configuration
# Delete cron
if [ -e "/etc/cron.d/$app" ]; then
echo "Delete cron"
sudo rm "/etc/cron.d/$app"
fi
SECURE_REMOVE '/var/log/$app/' # Delete log
REMOVE_LOGROTATE_CONF # Delete logrotate configuration
ynh_package_remove build-essential || echo "build-essential already uninstalled"
# Reload SSOwat configuration
sudo yunohost app ssowatconf
echo -e "\e[0m" # Restore normal color