1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/radicale_ynh.git synced 2024-09-03 20:16:14 +02:00
radicale_ynh/scripts/remove

82 lines
2.1 KiB
Text
Raw Normal View History

2016-04-07 00:00:41 +02:00
#!/bin/bash
# Récupère les infos de l'application.
2016-05-20 00:03:02 +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
2016-06-04 23:08:49 +02:00
source /usr/share/yunohost/helpers
2016-05-20 00:03:02 +02:00
else
app=radicale
fi
2016-04-07 00:00:41 +02:00
domain=$(sudo yunohost app setting $app domain)
# Suppression des dossiers de l'application
2016-05-20 00:03:02 +02:00
if [ -e "/var/www/$app/" ]; then # Delete final_path
echo "Delete app dir"
sudo rm -r "/var/www/$app/"
fi
if [ -e "/opt/yunohost/$app" ]; then
echo "Delete virtualenv"
sudo rm -r "/opt/yunohost/$app"
fi
if [ -e "/etc/$app/" ]; then
echo "Delete radicale config"
sudo rm -r "/etc/$app/"
fi
2016-04-07 00:00:41 +02:00
2016-05-20 00:03:02 +02:00
# Suppression de la configuration uwsgi
2016-04-07 00:00:41 +02:00
# Stoppe le service uwsgi
sudo service uwsgi stop
2016-05-20 00:03:02 +02:00
if [ -e "/etc/uwsgi/apps-available/radicale.ini" ]; then
echo "Delete uwsgi config"
sudo rm "/etc/uwsgi/apps-available/radicale.ini"
fi
if [ -e "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
echo "Delete uwsgi config"
sudo rm "/etc/uwsgi/apps-enabled/radicale.ini"
fi
if grep -q "^radicale:" /etc/passwd # Test l'existence de l'utilisateur
then
sudo userdel radicale
fi
2016-04-07 00:00:41 +02:00
# Redémarre le service uwsgi
sudo service uwsgi start
# Suppression de la configuration nginx
2016-05-20 00:03:02 +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
2016-04-07 00:00:41 +02:00
2016-05-20 00:03:02 +02:00
# Suppression de la configuration du pool php-fpm
if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config
echo "Delete fpm config"
sudo rm "/etc/php5/fpm/pool.d/$app.conf"
fi
if [ -e "/etc/php5/fpm/conf.d/20-$app.ini" ]; then # Delete php config
echo "Delete php config"
sudo rm "/etc/php5/fpm/conf.d/20-$app.ini"
2016-04-07 00:00:41 +02:00
fi
2016-05-20 00:03:02 +02:00
sudo service php5-fpm reload
2016-04-07 00:00:41 +02:00
# Suppression de la configuration de logrotate
2016-05-20 00:03:02 +02:00
if [ -e "/etc/logrotate.d/$app" ]; then
echo "Delete logrotate config"
sudo rm -r "/etc/logrotate.d/$app"
fi
2016-04-07 00:00:41 +02:00
2016-06-04 22:20:07 +02:00
if [ $ynh_version != "2.4" ]
then
# Retire le hook sur la création de nouveaux utilisateurs
sudo yunohost hook remove radicale
fi
2016-04-07 00:00:41 +02:00
# Régénère la configuration de SSOwat
sudo yunohost app ssowatconf
2016-05-20 00:03:02 +02:00
echo -e "\e[0m" # Restore normal color