blob: efa9b14c278848ca7641569eab6bc91397bb543d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#! /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
|