1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreerp_ynh.git synced 2024-09-03 19:36:13 +02:00
libreerp_ynh/scripts/remove

34 lines
770 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)
# If removing master instance, remove Odoo.
if [ "$instance" = "master" ]; then
sudo rm -f /etc/apt/sources.list.d/odoo.list
sudo apt-get update
sudo yunohost service stop odoo
ynh_package_remove odoo
ynh_package_remove wkhtmltopdf
sudo rm -f /etc/odoo/openerp-server.conf
sudo yunohost service remove odoo
fi
# Remove database
sudo su -c "dropdb $database" postgres
# Remove NGINX conf
sudo rm /etc/nginx/conf.d/$domain.d/$app.conf
# Reload
sudo service nginx reload
sudo yunohost app ssowatconf