1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00
lutim_ynh/scripts/remove

72 lines
1.8 KiB
Text
Raw Normal View History

2015-03-19 20:49:50 +01:00
#!/bin/bash
2015-11-18 00:28:42 +01:00
# Récupère les infos de l'application.
2016-05-20 00:01:21 +02:00
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
if [ $ynh_version = "2.4" ]; then
app=$YNH_APP_INSTANCE_NAME
# Source app helpers
. /usr/share/yunohost/helpers
else
app=lutim
fi
2015-03-19 20:49:50 +01:00
domain=$(sudo yunohost app setting $app domain)
2015-03-26 13:07:01 +01:00
2015-11-18 00:28:42 +01:00
# Arrêt du service
2016-05-20 00:01:21 +02:00
if [ -e "/etc/init.d/lutim" ]; then
echo "Delete init.d script"
sudo service lutim stop
sudo rm "/etc/init.d/lutim"
sudo rm "/etc/default/lutim"
2016-03-31 22:41:54 +02:00
sudo update-rc.d -f lutim remove
2016-05-20 00:01:21 +02:00
fi
if [ -e "/etc/systemd/system/lutim.service" ]; then
echo "Delete systemd script"
sudo service lutim stop
sudo rm "/etc/systemd/system/lutim.service"
2016-03-31 22:41:54 +02:00
sudo systemctl disable lutim.service
2016-05-20 00:01:21 +02:00
fi
# Retire le service du monitoring de Yunohost.
if sudo yunohost service status | grep -q lutim # Test l'existence du service dans Yunohost
then
echo "Remove lutim service"
sudo yunohost service remove lutim
2016-03-31 22:41:54 +02:00
fi
2015-03-26 13:07:01 +01:00
2015-11-18 00:28:42 +01:00
# Suppression du dossier de l'application
2016-05-20 00:01:21 +02:00
if [ -e "/var/www/$app" ]; then # Delete final_path
echo "Delete app dir"
sudo rm -r "/var/www/$app"
fi
2015-11-18 00:28:42 +01:00
# Suppression de la configuration nginx
2016-05-20 00:01:21 +02:00
if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config
echo "Delete nginx config"
sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf"
sudo service nginx reload
fi
2015-11-18 00:28:42 +01:00
2015-03-26 13:07:01 +01:00
# Retirer le cron
2016-05-20 00:01:21 +02:00
if [ -e "/etc/cron.d/$app" ]; then
echo "Delete cron"
sudo rm "/etc/cron.d/$app"
fi
2015-03-26 13:07:01 +01:00
# Suppression des log
2016-05-20 00:01:21 +02:00
if [ -e "/var/log/$app/" ]; then
echo "Delete log"
sudo rm -r "/var/log/$app/"
fi
2015-03-26 13:07:01 +01:00
2016-05-15 11:36:31 +02:00
# Suppression de la configuration de logrotate
2016-05-20 00:01:21 +02:00
if [ -e "/etc/logrotate.d/$app" ]; then
echo "Delete logrotate config"
sudo rm "/etc/logrotate.d/$app"
fi
2016-05-15 11:36:31 +02:00
2015-11-18 00:28:42 +01:00
# Régénère la configuration de SSOwat
2015-03-26 13:07:01 +01:00
sudo yunohost app ssowatconf
2016-05-20 00:01:21 +02:00
echo -e "\e[0m" # Restore normal color