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
|
|
|
|
2016-12-14 11:46:00 +01:00
|
|
|
sudo yunohost service stop odoo | true
|
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-12-14 11:46:00 +01:00
|
|
|
sudo yunohost service remove odoo | true
|
2016-12-14 12:47:31 +01:00
|
|
|
ynh_package_remove odoo | true
|
|
|
|
sudo dpkg -P odoo | true
|
|
|
|
ynh_psql_drop_db $APPNAME | true
|
2016-07-05 15:22:12 +02:00
|
|
|
fi
|
|
|
|
|
2016-12-14 10:10:53 +01:00
|
|
|
# Remove database
|
2016-12-14 11:46:00 +01:00
|
|
|
ynh_psql_drop_db $database | true
|
|
|
|
ynh_psql_drop_user $database | true
|
2016-12-14 10:10:53 +01:00
|
|
|
|
2016-12-14 11:04:44 +01:00
|
|
|
if [ "$instance" = "slave" ]; then
|
2016-12-14 11:46:00 +01:00
|
|
|
sudo yunohost service start odoo | true
|
2016-12-14 11:04:44 +01:00
|
|
|
fi
|
2015-09-14 17:12:17 +02:00
|
|
|
# Remove NGINX conf
|
2016-12-14 12:02:22 +01:00
|
|
|
sudo rm /etc/nginx/conf.d/$domain.d/$app.conf | true
|
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
|