summaryrefslogtreecommitdiff
path: root/databases
diff options
context:
space:
mode:
authorhubertf <hubertf>1999-03-28 21:50:17 +0000
committerhubertf <hubertf>1999-03-28 21:50:17 +0000
commita8e0aa74217eca2277e568c9189e07289bf6d965 (patch)
tree80eb8a0d80718b57ba6777bdb5f9f80550f32ae3 /databases
parent21dc966bce1b7c145f107ecc8cfc319a68628b7c (diff)
downloadpkgsrc-a8e0aa74217eca2277e568c9189e07289bf6d965.tar.gz
Make it possible to build a binary package by moving the "account
management" into a REQ script.
Diffstat (limited to 'databases')
-rw-r--r--databases/postgresql/Makefile19
-rw-r--r--databases/postgresql/pkg/REQ37
2 files changed, 49 insertions, 7 deletions
diff --git a/databases/postgresql/Makefile b/databases/postgresql/Makefile
index 4d71dd7995d..ae42cdafcb1 100644
--- a/databases/postgresql/Makefile
+++ b/databases/postgresql/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.28 1999/02/19 09:02:25 frueauf Exp $
+# $NetBSD: Makefile,v 1.29 1999/03/28 21:50:17 hubertf Exp $
# FreeBSD Id: Makefile,v 1.22 1997/12/24 01:21:37 alex Exp
#
@@ -20,9 +20,8 @@ DEPENDS+= addnerd-1.6:../../sysutils/addnerd
# Needs ELF clue, mips has no TAS implementation
NOT_FOR_ARCHS= alpha mips
-NO_PACKAGE= "Requires pgsql uid"
-
PLIST_SRC= ${WRKDIR}/PLIST.tmp
+REQ_FILE= ${WRKDIR}/REQ
PGUSER?= pgsql
PGGROUP?= ingres
@@ -69,11 +68,17 @@ post-build:
@ ${ECHO} "------------------------------------------------------------"
pre-install:
-.if defined(PACKAGE_BUILDING)
${RM} -rf ${PREFIX}/${PGUSER}
-.endif
- @${SETENV} ${MAKE_ENV} ${PREFIX}/sbin/addnerd -h ${PREFIX} -g ${PGGROUP} ${PGUSER}
- @${SED} -e 's|@PGUSER@|${PGUSER}|g' ${PKGDIR}/PLIST > ${PLIST_SRC}
+ @${SED} \
+ -e 's|@PGUSER@|${PGUSER}|g' \
+ -e 's|@PGGROUP@|${PGGROUP}|g' \
+ -e 's|@PREFIX@|${PREFIX}|g' \
+ -e 's|@LOCALBASE@|${LOCALBASE}|g' \
+ <${PKGDIR}/REQ > ${REQ_FILE}
+ @${SED} \
+ -e 's|@PGUSER@|${PGUSER}|g' \
+ <${PKGDIR}/PLIST > ${PLIST_SRC}
+ ${SH} ${REQ_FILE} ${PKGNAME} INSTALL
post-install:
@ if [ ! -f ${PREFIX}/${PGUSER}/.profile ]; then \
diff --git a/databases/postgresql/pkg/REQ b/databases/postgresql/pkg/REQ
new file mode 100644
index 00000000000..4bc4d69fd61
--- /dev/null
+++ b/databases/postgresql/pkg/REQ
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+PGUSER=@PGUSER@
+PGGROUP=@PGGROUP@
+ADDNERD=@LOCALBASE@/sbin/addnerd
+PREFIX=@PREFIX@
+
+
+PKG=$1
+STAGE=$2
+
+if [ "$STAGE" != "INSTALL" ];
+then
+ exit 0
+fi
+
+
+# use finger to be able to use NIS, ...
+if finger ${PGUSER} 2>&1 | grep >/dev/null "no such user"
+then
+ echo "Creating '$PGUSER' user ..."
+ ${ADDNERD} -h ${PREFIX} -g ${PGGROUP} ${PGUSER}
+ echo Done.
+else
+ echo "User '$PGUSER' already exists, proceeding."
+fi
+
+
+# Group... the default's shipped with NetBSD
+#
+if grep "^${PGGROUP}:" /etc/group 2>&1 >/dev/null
+then
+ echo "Group '$PGGROUP' already exists, proceeding."
+else
+ echo "Please add group '$PGGROUP' to /etc/group, then restart."
+ exit 1
+fi