libreerp_ynh/scripts/remove
2016-07-05 15:22:12 +02:00

31 lines
673 B
Bash

#!/bin/bash
set -eu
app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
database=${domain//./-}
instance=$(ynh_app_setting_get "$app" instance)
# Remove database
sudo su -c "dropdb $database" postgres
# If removing master instance, remove Odoo.
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
# Remove NGINX conf
sudo rm /etc/nginx/conf.d/$domain.d/$app.conf
# Reload
sudo service nginx reload
sudo yunohost app ssowatconf