freebsd-ports/databases/postgresql84-server/pkg-install-server
Palle Girgensohn 1d25499d3d Update all PostgreSQL ports to latest versions.
This includes a bunch of security fixes: CVE-2007-6067, CVE-2007-4772,
CVE-2007-6601, CVE-2007-6600 and CVE-2007-4769.

Security: http://www.postgresql.org/about/news.905
2008-01-07 13:51:57 +00:00

65 lines
1.3 KiB
Bash

#! /bin/sh
# $FreeBSD$
PATH=/bin:/usr/bin:/usr/sbin
DB_DIR=${PKG_PREFIX}/${PGUSER}
backupwarning() { echo "
== BETA QUALITY, NOT FOR PRODUCTION USE! ==
=========== 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
USER=${PGUSER}
GROUP=${PGGROUP}
UID=70
GID=70
if pw group show "${GROUP}" 2>/dev/null; then
echo "You already have a group \"${GROUP}\", so I will use it."
else
if pw groupadd ${GROUP} -g ${GID}; then
echo "Added group \"${GROUP}\"."
else
echo "Adding group \"${GROUP}\" failed..."
exit 1
fi
fi
if pw user show "${USER}" 2>/dev/null; then
echo "You already have a user \"${USER}\", so I will use it."
else
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
-d ${DB_DIR} -c "PostgreSQL Daemon"
then
echo "Added user \"${USER}\"."
else
echo "Adding user \"${USER}\" failed..."
exit 1
fi
fi
if ! [ -x ~${PGUSER} ] ; then
install -m 755 -o ${PGUSER} -g ${PGGROUP} -d ${DB_DIR}
fi
;;
BACKUPWARNING)
backupwarning
;;
esac