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
|
2016-12-14 10:55:15 +01:00
|
|
|
|
|
|
|
# Load common variables
|
|
|
|
source ./_common.sh
|
|
|
|
|
2016-07-05 15:22:12 +02:00
|
|
|
# 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
|
|
|
|
|
|
|
# If removing master instance, remove Odoo.
|
2016-07-05 15:22:12 +02:00
|
|
|
if [ "$instance" = "master" ]; then
|
2016-12-14 10:10:53 +01:00
|
|
|
sudo rm -f /etc/apt/sources.list.d/odoo.list
|
|
|
|
sudo apt-get update
|
2016-07-05 15:22:12 +02:00
|
|
|
sudo yunohost service stop odoo
|
2016-12-14 10:10:53 +01:00
|
|
|
ynh_package_remove odoo
|
|
|
|
ynh_package_remove wkhtmltopdf
|
|
|
|
sudo rm -f /etc/odoo/openerp-server.conf
|
2016-07-05 15:22:12 +02:00
|
|
|
sudo yunohost service remove odoo
|
|
|
|
fi
|
|
|
|
|
2016-12-14 10:10:53 +01:00
|
|
|
# Remove database
|
|
|
|
sudo su -c "dropdb $database" postgres
|
|
|
|
|
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
|