odoo/debian/postinst

37 lines
979 B
Bash

#!/bin/sh
set -e
ODOO_CONFIGURATION_FILE=/etc/openerp/openerp-server.conf
ODOO_GROUP="openerp"
ODOO_DATA_DIR=/var/lib/openerp
ODOO_LOG_DIR=/var/log/openerp
ODOO_USER="openerp"
case "${1}" in
configure)
if ! getent passwd | grep -q "^openerp:"; then
adduser --system --home $ODOO_DATA_DIR --quiet --group $ODOO_USER
fi
# Register "openerp" as a postgres superuser
su - postgres -c "createuser -s openerp" 2> /dev/null || true
# Configuration file
chown $ODOO_USER:$ODOO_GROUP $ODOO_CONFIGURATION_FILE
chmod 0640 $ODOO_CONFIGURATION_FILE
# Log
mkdir -p $ODOO_LOG_DIR
chown $ODOO_USER:$ODOO_GROUP $ODOO_LOG_DIR
chmod 0750 $ODOO_LOG_DIR
# Data dir
chown $ODOO_USER:$ODOO_GROUP $ODOO_DATA_DIR
# update-python-modules NOW otherwise invoke-rc.d openerp start will fail
update-python-modules
;;
*)
;;
esac
#DEBHELPER#
exit 0