diff options
Diffstat (limited to 'databases/postgresql/pkg/INSTALL')
-rw-r--r-- | databases/postgresql/pkg/INSTALL | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/databases/postgresql/pkg/INSTALL b/databases/postgresql/pkg/INSTALL index 9fccc75d701..b2a181ca822 100644 --- a/databases/postgresql/pkg/INSTALL +++ b/databases/postgresql/pkg/INSTALL @@ -1,40 +1,58 @@ #!/bin/sh # -# $NetBSD: INSTALL,v 1.2 2000/12/07 16:56:41 jlam Exp $ +# $NetBSD: INSTALL,v 1.3 2000/12/11 16:43:12 jlam Exp $ PKGNAME=$1 STAGE=$2 USER=@PGUSER@ GROUP=@PGGROUP@ -USERDIR=@USERDIR@ + +ADDUSER="@ADDUSER@" +ADDGROUP="@ADDGROUP@" +CAT="@CAT@" +CHGRP="@CHGRP@" +CHMOD="@CHMOD@" +CHOWN="@CHOWN@" +CP="@CP@" +GREP="@GREP@" +MKDIR="@MKDIR@" +RM="@RM@" +SU="@SU@" +TOUCH="@TOUCH@" + PGHOME=${PKG_PREFIX}/${USER} case ${STAGE} in PRE-INSTALL) - echo ------------------------------------------------------------ - echo Dump existing databases, before installing new db version !! - echo ------------------------------------------------------------ - + ${CAT} << EOF +------------------------------------------------------------ +Dump existing databases, before installing new db version !! +------------------------------------------------------------ +EOF # Group... the default's shipped with NetBSD # We need to check that ${GROUP} exists before adding the user. + # Do it with chgrp to be able to use NIS. # - if ${USERDIR}/group info -e ${GROUP} + ${TOUCH} "/tmp/grouptest.$$" + ${CHGRP} ${GROUP} "/tmp/grouptest.$$" >/dev/null 2>&1 + if [ $? -eq 0 ] then echo "Group '${GROUP}' already exists...proceeding." else echo "Creating '${GROUP}' group..." - ${USERDIR}/group add ${GROUP} + ${ADDGROUP} ${GROUP} echo "Done." fi + ${RM} -f "/tmp/grouptest.$$" - # use finger to be able to use NIS, ... + # Use `finger' to be able to use NIS. # - mkdir -p ${PGHOME} - if finger ${USER} 2>&1 | grep >/dev/null "no such user" + finger ${USER} 2>&1 | ${GREP} -q "no such user" + if [ $? -eq 0 ] then echo "Creating '${USER}' user..." - ${USERDIR}/user add \ + ${ADDUSER} \ -c "PostgreSQL database administrator" \ -b ${PKG_PREFIX} \ -g ${GROUP} -s /bin/sh ${USER} @@ -42,20 +60,25 @@ PRE-INSTALL) else echo "User '${USER}' already exists...proceeding." fi - chown -R ${USER}:${GROUP} ${PGHOME} + ${MKDIR} ${PGHOME} + ${CHOWN} -R ${USER}:${GROUP} ${PGHOME} ;; + POST-INSTALL) if [ ! -f ${PGHOME}/.profile ]; then - cp ${PGHOME}/.profile.pgsql ${PGHOME}/.profile + ${CP} ${PGHOME}/.profile.pgsql ${PGHOME}/.profile + ${CHMOD} 644 ${PGHOME}/.profile fi - echo ------------------------------------------------------------------ - echo Initializing PostgreSQL Databases - this may take a few minutes... - echo ------------------------------------------------------------------ - echo "${PKG_PREFIX}/bin/initdb --pglib=${PKG_PREFIX}/share/postgresql --pgdata=${PGHOME}/data" | su -l ${USER} + ${CAT} << EOF +------------------------------------------------------------------ +Initializing PostgreSQL Databases - this may take a few minutes... +------------------------------------------------------------------ +EOF + echo "${PKG_PREFIX}/bin/initdb --pglib=${PKG_PREFIX}/share/postgresql --pgdata=${PGHOME}/data" | ${SU} -l ${USER} ;; *) - echo "Unexpected argument: $2" + echo "Unexpected argument: ${STAGE}" exit 1 ;; esac |