postinst is in openerp6.1-full 6.1-1+dfsg-0ubuntu3.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #!/bin/sh
set -e
# source debconf
. /usr/share/debconf/confmodule
case "${1}" in
configure)
db_version 2.0
db_get openerp6.1-full/install_type
_INSTALL_TYPE="${RET}"
if [ "${_INSTALL_TYPE}" = "remote" ]; then
# need to ask for host, user, password
db_get openerp6.1-full/install_host
_INSTALL_HOST="${RET}"
db_get openerp6.1-full/install_port
_INSTALL_PORT="${RET}"
db_get openerp6.1-full/install_user
_INSTALL_USER="${RET}"
db_get openerp6.1-full/install_password
_INSTALL_PASSWORD="${RET}"
else
_INSTALL_HOST="False"
_INSTALL_PORT="False"
_INSTALL_USER="openerp"
_INSTALL_PASSWORD="False"
# register openerp as a postgres superuser with no password
su - postgres -c "createuser -s openerp" 2> /dev/null || true
fi
# modify config file
sed -i "s/^\(db_host\s*=\s*\).*$/\1${_INSTALL_HOST}/" /etc/openerp/openerp-server.conf
sed -i "s/^\(db_port\s*=\s*\).*$/\1${_INSTALL_PORT}/" /etc/openerp/openerp-server.conf
# don't expose db_user and db_password in proc
sed -i "s/^\(db_user\s*=\s*\).*$//" /etc/openerp/openerp-server.conf
echo "db_user = ${_INSTALL_USER}" >> /etc/openerp/openerp-server.conf
sed -i "s/^\(db_password\s*=\s*\).*$//" /etc/openerp/openerp-server.conf
echo "db_password = ${_INSTALL_PASSWORD}" >> /etc/openerp/openerp-server.conf
# and restart service
service openerp-server restart
db_stop
;;
*)
;;
esac
exit 0
|