Debian: Enable plpgsql when using PostgreSQL 8.x
In case PostgreSQL 8.x is being used, make sure that support for plpgsql is enabled. This is needed starting with version 1.3 of Libreplan. Note that the major version number number is taken from the output of "createlang --version", so this assumes that the version for which the tool is available is actually the one being run. This assumption should be safe in the vast majority of cases.
This commit is contained in:
parent
aa258a57ee
commit
ea5e300907
1 changed files with 26 additions and 0 deletions
26
debian/libreplan.postinst
vendored
26
debian/libreplan.postinst
vendored
|
|
@ -1,6 +1,32 @@
|
|||
#! /bin/bash
|
||||
set -e
|
||||
|
||||
# If the database exists already *before* running dbconfig, it means that
|
||||
# an upgrade is being done. In case PostgreSQL 8.x is being used, make
|
||||
# sure that support for plpgsql is enabled. This is needed starting with
|
||||
# Libreplan 1.3
|
||||
#
|
||||
if [[ $1 = configure && -r /etc/dbconfig-common/libreplan.conf ]]
|
||||
then
|
||||
PGSQL_MAJOR=$(createlang --version |
|
||||
sed -e '1s/^[^0-9]*\([0-9]\+\)\..*$/\1/p' -e d)
|
||||
if [[ ${PGSQL_MAJOR} -eq 8 ]]
|
||||
then
|
||||
. /etc/dbconfig-common/libreplan.conf
|
||||
|
||||
conn_args=""
|
||||
if [[ ${dbc_dbserver} != localhost ]] ; then
|
||||
conn_args="${conn_args} --host='${dbc_dbserver}'"
|
||||
fi
|
||||
if [[ -n ${dbc_dbport} ]] ; then
|
||||
conn_args="${conn_args} --port=${dbc_dbport}"
|
||||
fi
|
||||
|
||||
su postgres -c "createlang -d ${dbc_dbname} ${conn_args} plpgsql" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue