summaryrefslogtreecommitdiff
path: root/databases
diff options
context:
space:
mode:
authorwennmach <wennmach>2001-03-25 11:29:37 +0000
committerwennmach <wennmach>2001-03-25 11:29:37 +0000
commitf86bec8c9368f355d6124eaaef323b26677ed712 (patch)
treed8e847052ee44aab03cf8a442f94402eec6baaf1 /databases
parent7da3e63aa49881136834a5c1dd529c46f5ceb90c (diff)
downloadpkgsrc-f86bec8c9368f355d6124eaaef323b26677ed712.tar.gz
Make pgsql's home directory configurable. This is useful e. g. in cases
where ${PREFIX} is mounted read-only etc. Checked with Johnny C. Lam, who suggested two additional changes.
Diffstat (limited to 'databases')
-rw-r--r--databases/postgresql/Makefile16
-rw-r--r--databases/postgresql/files/pgsql.sh4
-rw-r--r--databases/postgresql/pkg/DEINSTALL4
-rw-r--r--databases/postgresql/pkg/INSTALL21
-rw-r--r--databases/postgresql/pkg/PLIST5
5 files changed, 31 insertions, 19 deletions
diff --git a/databases/postgresql/Makefile b/databases/postgresql/Makefile
index 07079fc02b9..58ec625afd5 100644
--- a/databases/postgresql/Makefile
+++ b/databases/postgresql/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.62 2001/02/26 18:09:40 lukem Exp $
+# $NetBSD: Makefile,v 1.63 2001/03/25 11:29:37 wennmach Exp $
# FreeBSD Id: Makefile,v 1.22 1997/12/24 01:21:37 alex Exp
#
@@ -18,16 +18,18 @@ NOT_FOR_PLATFORM= *-*-mips
# PGUSER username of the database administrator
# PGGROUP group of the database administrator
+# PGHOME home directory of the database administrator and
+# location of the databases
#
PGUSER?= pgsql
PGGROUP?= pgsql
+PGHOME?= ${PREFIX}/${PGUSER}
MESSAGE= ${FILESDIR}/post-install-notes
DEINSTALL_FILE= ${WRKDIR}/DEINSTALL
INSTALL_FILE= ${WRKDIR}/INSTALL
-PGHOME= ${PREFIX}/${PGUSER}
-BUILD_DEFS= PGUSER PGROUP
+BUILD_DEFS= PGUSER PGROUP PGHOME
PLIST_SUBST= PGUSER=${PGUSER}
PLIST_SRC+= ${PKGDIR}/PLIST
PLIST_SRC+= ${PKGDIR}/PLIST.spi
@@ -66,6 +68,7 @@ post-build:
< ${FILESDIR}/profile.pgsql > ${WRKDIR}/profile.pgsql
${SED} -e "s|@PREFIX@|${PREFIX}|g" \
-e "s|@PGUSER@|${PGUSER}|g" \
+ -e "s|@PGHOME@|${PGHOME}|g" \
-e "s|@SU@|${SU}|g" \
< ${FILESDIR}/pgsql.sh > ${WRKDIR}/pgsql.sh
@@ -84,10 +87,12 @@ pre-install:
${SED} -e 's|@PGUSER@|${PGUSER}|g' \
-e "s,@PGGROUP@,${PGGROUP},g" \
+ -e "s,@PGHOME@,${PGHOME},g" \
-e "s,@CAT@,${CAT},g" \
< ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE}
${SED} -e "s,@PGUSER@,${PGUSER},g" \
-e "s,@PGGROUP@,${PGGROUP},g" \
+ -e "s,@PGHOME@,${PGHOME},g" \
-e "s,@ADDUSER@,${ADDUSER},g" \
-e "s,@ADDGROUP@,${ADDGROUP},g" \
-e "s,@CAT@,${CAT},g" \
@@ -120,9 +125,8 @@ post-install:
.for PROG in ecpg pg_dump pg_encoding pg_id pg_passwd pg_version postgres psql
strip ${PREFIX}/bin/${PROG}
.endfor
- ${INSTALL_DATA} ${WRKDIR}/profile.pgsql ${PGHOME}/.profile.pgsql
- ${INSTALL_DATA} ${FILESDIR}/post-install-notes ${PGHOME}
- ${CHOWN} -R ${PGUSER}:${PGGROUP} ${PGHOME}
+ ${INSTALL_DATA} ${WRKDIR}/profile.pgsql \
+ ${PREFIX}/share/postgresql/profile.pgsql.sample
${INSTALL_SCRIPT} ${WRKDIR}/pgsql.sh ${PREFIX}/etc/rc.d/pgsql
diff --git a/databases/postgresql/files/pgsql.sh b/databases/postgresql/files/pgsql.sh
index 4d021c1b963..d76a31e9513 100644
--- a/databases/postgresql/files/pgsql.sh
+++ b/databases/postgresql/files/pgsql.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: pgsql.sh,v 1.2 2001/02/12 20:11:56 jlam Exp $
+# $NetBSD: pgsql.sh,v 1.3 2001/03/25 11:29:37 wennmach Exp $
#
# PostgreSQL database rc.d control script
#
@@ -18,7 +18,7 @@ command_args="-S -o -F" # start in silent mode and disable
# connections
USER="@PGUSER@"
-PGHOME="@PREFIX@/${USER}"
+PGHOME="@PGHOME@"
SU="@SU@"
cmd=${1:-start}
diff --git a/databases/postgresql/pkg/DEINSTALL b/databases/postgresql/pkg/DEINSTALL
index a4be1f0cce5..68d8f54d76a 100644
--- a/databases/postgresql/pkg/DEINSTALL
+++ b/databases/postgresql/pkg/DEINSTALL
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: DEINSTALL,v 1.4 2000/12/11 16:43:12 jlam Exp $
+# $NetBSD: DEINSTALL,v 1.5 2001/03/25 11:29:37 wennmach Exp $
#
PKGNAME=$1
@@ -8,10 +8,10 @@ STAGE=$2
USER="@PGUSER@"
GROUP="@PGGROUP@"
+PGHOME="@PGHOME@"
CAT="@CAT@"
-PGHOME=${PKG_PREFIX}/${USER}
case ${STAGE} in
DEINSTALL)
diff --git a/databases/postgresql/pkg/INSTALL b/databases/postgresql/pkg/INSTALL
index b2a181ca822..bc1299a511b 100644
--- a/databases/postgresql/pkg/INSTALL
+++ b/databases/postgresql/pkg/INSTALL
@@ -1,12 +1,13 @@
#!/bin/sh
#
-# $NetBSD: INSTALL,v 1.3 2000/12/11 16:43:12 jlam Exp $
+# $NetBSD: INSTALL,v 1.4 2001/03/25 11:29:37 wennmach Exp $
PKGNAME=$1
STAGE=$2
USER=@PGUSER@
GROUP=@PGGROUP@
+PGHOME=@PGHOME@
ADDUSER="@ADDUSER@"
ADDGROUP="@ADDGROUP@"
@@ -21,8 +22,6 @@ RM="@RM@"
SU="@SU@"
TOUCH="@TOUCH@"
-PGHOME=${PKG_PREFIX}/${USER}
-
case ${STAGE} in
PRE-INSTALL)
${CAT} << EOF
@@ -54,8 +53,16 @@ EOF
echo "Creating '${USER}' user..."
${ADDUSER} \
-c "PostgreSQL database administrator" \
- -b ${PKG_PREFIX} \
- -g ${GROUP} -s /bin/sh ${USER}
+ -d ${PGHOME} \
+ -g ${GROUP} \
+ -s /bin/sh \
+ ${USER}
+ # "useradd -d" in NetBSD-1.5 creates a home directory and populates
+ # it with dot files regardless if -m was given or not. This behaviour
+ # was changed in later versions. We delete the newly created .profile
+ # here so that the sample profile.pgsql gets installed in the
+ # POST-INSTALL stage.
+ ${RM} -f ${PGHOME}/.profile
echo "Done."
else
echo "User '${USER}' already exists...proceeding."
@@ -66,7 +73,9 @@ EOF
POST-INSTALL)
if [ ! -f ${PGHOME}/.profile ]; then
- ${CP} ${PGHOME}/.profile.pgsql ${PGHOME}/.profile
+ ${CP} ${PKG_PREFIX}/share/postgresql/profile.pgsql.sample \
+ ${PGHOME}/.profile
+ ${CHOWN} ${USER} ${PGHOME}/.profile
${CHMOD} 644 ${PGHOME}/.profile
fi
${CAT} << EOF
diff --git a/databases/postgresql/pkg/PLIST b/databases/postgresql/pkg/PLIST
index c4a44ddd2d9..3748cb3f98e 100644
--- a/databases/postgresql/pkg/PLIST
+++ b/databases/postgresql/pkg/PLIST
@@ -1,6 +1,4 @@
-@comment $NetBSD: PLIST,v 1.17 2001/01/04 15:10:24 agc Exp $
-${PGUSER}/.profile.pgsql
-${PGUSER}/post-install-notes
+@comment $NetBSD: PLIST,v 1.18 2001/03/25 11:29:38 wennmach Exp $
bin/createdb
bin/createlang
bin/createuser
@@ -1037,3 +1035,4 @@ share/postgresql/pg_hba.conf.sample
share/postgresql/pg_ident.conf.sample
share/postgresql/pg_options.sample
share/postgresql/postmaster.opts.default.sample
+share/postgresql/profile.pgsql.sample