2014-12-10 06:20:15 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-02-27 08:41:23 -05:00
|
|
|
[ "$1" != "--" ] && exec "$@" || shift
|
|
|
|
|
2015-01-02 04:57:31 -05:00
|
|
|
CONFIG_FILE=/etc/odoo/openerp-server.conf
|
|
|
|
|
|
|
|
# sets a configuration variable in openerp-server.conf
|
|
|
|
# $1: key, $2: value
|
|
|
|
function set_config {
|
2015-02-27 08:56:57 -05:00
|
|
|
temp=`mktemp`
|
2015-01-02 04:57:31 -05:00
|
|
|
if grep -q "^$1.*" $CONFIG_FILE
|
|
|
|
then
|
2015-02-27 08:56:57 -05:00
|
|
|
sed "s/^$1.*$/$1 = $2/" $CONFIG_FILE > $temp
|
2015-01-02 04:57:31 -05:00
|
|
|
else
|
2015-02-27 08:56:57 -05:00
|
|
|
sed "$ a$1 = $2" $CONFIG_FILE > $temp
|
2015-01-02 04:57:31 -05:00
|
|
|
fi
|
2015-02-27 08:56:57 -05:00
|
|
|
cat $temp > $CONFIG_FILE
|
2015-01-02 04:57:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# set odoo data directory and database host, port, user and password
|
|
|
|
set_config "data_dir" "\/var\/lib\/odoo"
|
|
|
|
set_config "db_host" $DB_PORT_5432_TCP_ADDR
|
|
|
|
set_config "db_port" $DB_PORT_5432_TCP_PORT
|
|
|
|
set_config "db_user" $DB_ENV_POSTGRES_USER
|
|
|
|
set_config "db_password" $DB_ENV_POSTGRES_PASSWORD
|
2014-12-10 06:20:15 -05:00
|
|
|
|
2014-12-29 04:36:27 -05:00
|
|
|
# start Odoo
|
2015-02-27 08:56:57 -05:00
|
|
|
exec /usr/bin/openerp-server --config $CONFIG_FILE "$@"
|