libreerp_ynh/scripts/remove

32 lines
673 B
Text
Raw Normal View History

2015-09-14 17:12:17 +02:00
#!/bin/bash
2016-07-05 15:22:12 +02:00
set -eu
app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
2015-09-20 08:34:07 +02:00
database=${domain//./-}
2016-07-05 15:22:12 +02:00
instance=$(ynh_app_setting_get "$app" instance)
2015-09-14 17:12:17 +02:00
2015-09-16 13:00:17 +02:00
# Remove database
2016-07-05 15:22:12 +02:00
sudo su -c "dropdb $database" postgres
2015-09-16 13:00:17 +02:00
# If removing master instance, remove Odoo.
2016-07-05 15:22:12 +02:00
if [ "$instance" = "master" ]; then
# Remove Odoo
sudo yunohost service stop odoo
sudo apt-get remove odoo -y
sudo apt-get remove wkhtmltopdf -y
sudo yunohost service remove odoo
fi
2015-09-14 17:12:17 +02:00
# Remove NGINX conf
2016-07-05 15:22:12 +02:00
sudo rm /etc/nginx/conf.d/$domain.d/$app.conf
2015-09-14 17:12:17 +02:00
# Reload
2016-07-05 15:22:12 +02:00
sudo service nginx reload
sudo yunohost app ssowatconf