PREIN
/bin/sh
if [ -f /etc/sysconfig/postgresql ]; then
POSTGRES_DATA_DIR=/var/lib/pgsql
. /etc/sysconfig/postgresql
if [ -f $POSTGRES_DATA_DIR/PG_VERSION ]; then
if [ `cat $POSTGRES_DATA_DIR/PG_VERSION` != '7.2' ]; then
echo "Database(s) in older, incompatible format exist in $POSTGRES_DATA_DIR."
echo "Dump them and clean $POSTGRES_DATA_DIR, then upgrade postgresql and"
echo "restore database(s)."
echo
echo "Warning for upgrade from version *before* 7.2."
echo "Please note, that postgresql module path changed from"
echo "/usr/lib/pgsql/module to /usr/lib/postgresql. Change the path"
echo "in dump file before restore."
exit 1
fi
fi
fi
getgid postgres >/dev/null 2>&1 || /usr/sbin/groupadd -g 88 -r -f postgres
if id postgres >/dev/null 2>&1 ; then
/usr/sbin/usermod -d /home/services/postgres postgres
else
/usr/sbin/useradd -M -o -r -u 88 \
-d /home/services/postgres -s /bin/sh -g postgres \
-c "PostgreSQL Server" postgres
fi
PREUN
/bin/sh
if [ "$1" = "0" ]; then
if [ -f /var/lock/subsys/postgresql ]; then
/etc/rc.d/init.d/postgresql stop
fi
/sbin/chkconfig --del postgresql
fi
POSTIN
/bin/sh
/sbin/chkconfig --add postgresql
if [ -f /var/lock/subsys/postgresql ]; then
/etc/rc.d/init.d/postgresql restart >&2
else
echo "Run \"/etc/rc.d/init.d/postgresql start\" to start postgresql server."
fi