diff options
Diffstat (limited to 'databases/postgresql')
-rw-r--r-- | databases/postgresql/Makefile | 19 | ||||
-rw-r--r-- | databases/postgresql/files/pgsql.sh | 57 | ||||
-rw-r--r-- | databases/postgresql/files/pgsql.sh.tmpl | 39 |
3 files changed, 68 insertions, 47 deletions
diff --git a/databases/postgresql/Makefile b/databases/postgresql/Makefile index 10e9b411977..24d44ad4ef9 100644 --- a/databases/postgresql/Makefile +++ b/databases/postgresql/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.57 2000/12/11 16:43:11 jlam Exp $ +# $NetBSD: Makefile,v 1.58 2000/12/11 20:18:56 jlam Exp $ # FreeBSD Id: Makefile,v 1.22 1997/12/24 01:21:37 alex Exp # @@ -49,6 +49,16 @@ ADDUSER= useradd ADDGROUP= groupadd .endif +post-build: + ${SED} -e 's|@PATH@|${PATH}|g' \ + -e 's|@MANPATH@|${MANPATH}|g' \ + -e 's|@PREFIX@|${PREFIX}|g' \ + < ${FILESDIR}/profile.pgsql > ${WRKDIR}/profile.pgsql + ${SED} -e "s|@PREFIX@|${PREFIX}|g" \ + -e "s|@PGUSER@|${PGUSER}|g" \ + -e "s|@SU@|${SU}|g" \ + < ${FILESDIR}/pgsql.sh > ${WRKDIR}/pgsql.sh + pre-install: @case "X${PGUSER}" in \ Xbin|Xetc|Xinclude|Xinfo|Xlib|Xlibdata|Xlibexec|Xman|Xsbin|Xshare) \ @@ -100,17 +110,10 @@ post-install: .for PROG in ecpg pg_dump pg_encoding pg_id pg_passwd pg_version postgres psql strip ${PREFIX}/bin/${PROG} .endfor - ${SED} -e 's|@PATH@|${PATH}|g' \ - -e 's|@MANPATH@|${MANPATH}|g' \ - -e 's|@PREFIX@|${PREFIX}|g' \ - < ${FILESDIR}/profile.pgsql > ${WRKDIR}/profile.pgsql ${INSTALL_DATA} ${WRKDIR}/profile.pgsql ${PGHOME}/.profile.pgsql ${INSTALL_DATA} ${FILESDIR}/post-install-notes ${PGHOME} ${CHOWN} -R ${PGUSER}:${PGGROUP} ${PGHOME} - ${SED} -e "s|@PREFIX@|${PREFIX}|g" \ - -e "s|@PGUSER@|${PGUSER}|g" \ - < ${FILESDIR}/pgsql.sh.tmpl > ${WRKDIR}/pgsql.sh ${INSTALL_SCRIPT} ${WRKDIR}/pgsql.sh ${PREFIX}/etc/rc.d/pgsql ${CAT} ${FILESDIR}/exclude ${FILESDIR}/man.tcl ${FILESDIR}/man.tk \ diff --git a/databases/postgresql/files/pgsql.sh b/databases/postgresql/files/pgsql.sh new file mode 100644 index 00000000000..4fd0a2d9ae5 --- /dev/null +++ b/databases/postgresql/files/pgsql.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# $NetBSD: pgsql.sh,v 1.1 2000/12/11 20:18:57 jlam Exp $ +# +# PostgreSQL database rc.d control script +# +# PROVIDE: pgsql +# REQUIRE: DAEMON + +name="postgres" +ctl_command="@PREFIX@/bin/pg_ctl" +command="@PREFIX@/bin/postmaster" +command_args="-S -o -F" # start in silent mode and disable + # automatic fsync after each + # transaction +#command_args="-S -i -o -F" # as above, but also allows TCP/IP + # connections + +USER="@PGUSER@" +PGHOME="@PREFIX@/${USER}" +SU="@SU@" + +cmd=${1:-start} + +if [ -x ${ctl_command} -a -x ${command} ] +then + case ${cmd} in + restart) + echo "Restarting ${name}." + echo "exec ${ctl_command} restart >> ${PGHOME}/errlog" \ + | ${SU} -l ${USER} + ;; + + start) + echo "Starting ${name}." + echo "exec ${ctl_command} \ + -p ${command} -o \"${command_args}\" start" \ + | ${SU} -l ${USER} + ;; + + stop) + echo "Stopping ${name}." + echo "exec ${ctl_command} stop >> ${PGHOME}/errlog" \ + | ${SU} -l ${USER} + ;; + + status) + echo "exec ${ctl_command} status" \ + | ${SU} -l ${USER} + ;; + + *) + echo 1>&2 "Usage: $0 [restart|start|stop|status]" + exit 1 + ;; + esac +fi diff --git a/databases/postgresql/files/pgsql.sh.tmpl b/databases/postgresql/files/pgsql.sh.tmpl deleted file mode 100644 index dac496d6244..00000000000 --- a/databases/postgresql/files/pgsql.sh.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# -# $NetBSD: pgsql.sh.tmpl,v 1.9 2000/12/07 16:56:40 jlam Exp $ -# FreeBSD Id: pgsql.sh.tmpl,v 1.3 1997/10/05 21:00:49 andreas Exp -# -# pgsql.sh - postgresql startup file for NetBSD -# -# PROVIDE: pgsql -# REQUIRE: DAEMON - -CMD=${1:-start} -USER=@PGUSER@ -PGHOME=@PREFIX@/${USER} - -if [ -x @PREFIX@/bin/postmaster -a -x @PREFIX@/bin/pg_ctl ] -then - case ${CMD} in - start) - echo -n ' pgsql' - su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl \ - -p @PREFIX@/bin/postmaster -o "-S -o -F" start \ - > ${PGHOME}/errlog' - ;; - stop) - su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl stop \ - >> ${PGHOME}/errlog' - ;; - restart) - su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl restart \ - >> ${PGHOME}/errlog' - ;; - status) - su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl status' - ;; - *) - echo "Unexpected argument: ${CMD}" - ;; - esac -fi |