freebsd-ports/databases/postgresql91-server/files/pkg-install-server.in
Palle Girgensohn 73c856222e Update PostgreSQL to 9.0.4, 8.4.8, 8.3.15 and 8.2.21.
This update contains a critical fix to the pg_upgrade utility
which prevents significant downtime issues. Do not use
pg_upgrade without installing this update first.

The issue with pg_upgrade and the fix are detailed on the PostgreSQL
wiki: http://wiki.postgresql.org/wiki/20110408pg_upgrade_fix
Users who have already used pg_upgrade should run the database repair
script given on that page on their databases as soon as possible.

See the release notes for each version at
http://www.postgresql.org/docs/current/static/release.html for a full
list of changes with details.

Allow the username of the postgresql user to configurable for 8.4 and 9.0.
Largely inspired by the work of Jason Helfman [153668, 153136].

Change PGUSER knob to PG_USER not to clash with PGUSER environment.

PR: 153668, 153136, 155493, 155137
2011-04-18 23:34:27 +00:00

66 lines
1.5 KiB
Bash

#! /bin/sh
# $FreeBSD: /tmp/pcvs/ports/databases/postgresql91-server/files/Attic/pkg-install-server.in,v 1.1 2011-04-18 23:34:27 girgen Exp $
PATH=/bin:/usr/bin:/usr/sbin
PG_USER=%%PG_USER%%
PG_GROUP=%%PG_GROUP%%
PG_UID=%%PG_UID%%
backupwarning() { echo "
=========== BACKUP YOUR DATA! =============
As always, backup your data before
upgrading. If the upgrade leads to a higher
minor revision (e.g. 7.3.x -> 7.4), a dump
and restore of all databases is
required. This is *NOT* done by the port!
Press ctrl-C *now* if you need to pg_dump.
===========================================
"
sleep 5
}
case $2 in
PRE-INSTALL)
backupwarning
PGUSER=${PGUSER:-${PG_USER}}
PGGROUP=${PGGROUP:-${PG_GROUP}}
DB_DIR=${PKG_PREFIX}/${PGUSER}
UID=${PG_UID}
GID=${PG_UID}
if pw group show "${PGGROUP}" 2>/dev/null; then
echo "You already have a group \"${PGGROUP}\", so I will use it."
else
if pw groupadd ${PGGROUP} -g ${GID}; then
echo "Added group \"${PGGROUP}\"."
else
echo "Adding group \"${PGGROUP}\" failed..."
exit 1
fi
fi
if pw user show "${PGUSER}" 2>/dev/null; then
echo "You already have a user \"${PGUSER}\", so I will use it."
else
if pw useradd ${PGUSER} -u ${UID} -g ${PGGROUP} -h - \
-d ${DB_DIR} -c "PostgreSQL Daemon"
then
echo "Added user \"${PGUSER}\"."
else
echo "Adding user \"${PGUSER}\" failed..."
exit 1
fi
fi
if ! [ -x ~${PGUSER} ] ; then
install -m 755 -o ${PGUSER} -g ${PGGROUP} -d ${DB_DIR}
fi
;;
BACKUPWARNING)
backupwarning
;;
esac