libreerp_ynh/scripts/remove

43 lines
904 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
# 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:04:44 +01:00
sudo yunohost service stop odoo
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
sudo rm -f /etc/apt/sources.list.d/odoo.list
sudo apt-get update
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
# Remove database
2016-12-14 11:33:39 +01:00
ynh_psql_drop_db $database
ynh_psql_drop_user $database
2016-12-14 11:04:44 +01:00
if [ "$instance" = "slave" ]; then
sudo yunohost service start 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