summaryrefslogtreecommitdiff
path: root/databases/postgresql-server
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2001-05-14 14:50:23 +0000
committerjlam <jlam@pkgsrc.org>2001-05-14 14:50:23 +0000
commitd5ea6e5030b4892b0770dd43ef0f3ba3de03d851 (patch)
treeb978760923fe5324f01a3fca3d54b2fdf5e8ef85 /databases/postgresql-server
parent441c1f1d885b411cc840c3bd5dac30e0667dc625 (diff)
downloadpkgsrc-d5ea6e5030b4892b0770dd43ef0f3ba3de03d851.tar.gz
postgresql-server: PostgreSQL database backend server programs
This package also has an enhanced rc.d-style startup script that respects rc.conf settings. If you are running NetBSD>=1.5, then add pgsql=YES to /etc/rc.conf, and set pgsql_flags to any options you wish to pass to the postmaster.
Diffstat (limited to 'databases/postgresql-server')
-rw-r--r--databases/postgresql-server/Makefile105
-rw-r--r--databases/postgresql-server/files/man.server4
-rw-r--r--databases/postgresql-server/files/pgsql.sh76
-rw-r--r--databases/postgresql-server/pkg/DEINSTALL42
-rw-r--r--databases/postgresql-server/pkg/DESCR9
-rw-r--r--databases/postgresql-server/pkg/INSTALL81
-rw-r--r--databases/postgresql-server/pkg/MESSAGE23
-rw-r--r--databases/postgresql-server/pkg/PLIST14
8 files changed, 354 insertions, 0 deletions
diff --git a/databases/postgresql-server/Makefile b/databases/postgresql-server/Makefile
new file mode 100644
index 00000000000..528db2baddd
--- /dev/null
+++ b/databases/postgresql-server/Makefile
@@ -0,0 +1,105 @@
+# $NetBSD: Makefile,v 1.1.1.1 2001/05/14 14:50:23 jlam Exp $
+
+.include "../../databases/postgresql/Makefile.common"
+.include "../../databases/postgresql/Makefile.getopt"
+.include "../../databases/postgresql/Makefile.ssl"
+
+PKGNAME= postgresql-server-${PG_VERS}
+PG_PKG_VERS= # empty
+COMMENT= PostgreSQL database server programs
+
+DEPENDS+= postgresql-client>=${PG_BASE_VERS}:../../databases/postgresql-client
+
+# mips has no TAS implementation
+NOT_FOR_PLATFORM= *-*-mips
+
+DIRS_TO_BUILD= src/backend
+
+# 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}
+BUILD_DEFS= PGUSER PGROUP PGHOME
+
+.if ${OPSYS} == "NetBSD"
+.if exists(/usr/sbin/user)
+ADDUSER= /usr/sbin/useradd
+ADDGROUP= /usr/sbin/groupadd
+.else
+DEPENDS+= user>=20000313:../../sysutils/user
+ADDUSER= ${LOCALBASE}/sbin/useradd
+ADDGROUP= ${LOCALBASE}/sbin/groupadd
+.endif
+.elif ${OPSYS} == "SunOS"
+ADDUSER= useradd
+ADDGROUP= groupadd
+.endif
+
+DEINSTALL_FILE= ${WRKDIR}/DEINSTALL
+INSTALL_FILE= ${WRKDIR}/INSTALL
+
+pre-configure: link-getopt-headers
+
+do-build:
+.for DIR in ${DIRS_TO_BUILD}
+ cd ${WRKSRC}/${DIR} && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${ALL_TARGET}
+.endfor
+
+pre-install:
+ @case "X${PGUSER}" in \
+ Xbin|Xetc|Xinclude|Xinfo|Xlib|Xlibdata|Xlibexec|Xman|Xsbin|Xshare) \
+ ${ECHO} "You have chosen PGUSER=${PGUSER} which will"; \
+ ${ECHO} "cause trouble, because the postgres home directory"; \
+ ${ECHO} "would be ${PGHOME}. Please"; \
+ ${ECHO} "set PGUSER to something more reasonable"; \
+ ${ECHO} "like pgsql."; \
+ ${ECHO} ""; \
+ ${FALSE}; \
+ ;; \
+ esac
+
+ ${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
+ ${SED} -e "s|@PGUSER@|${PGUSER}|g" \
+ -e "s|@PGGROUP@|${PGGROUP}|g" \
+ -e "s|@PGHOME@|${PGHOME}|g" \
+ -e "s|@CAT@|${CAT}|g" \
+ -e "s|@RM@|${RM}|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" \
+ -e "s|@CHGRP@|${CHGRP}|g" \
+ -e "s|@CHOWN@|${CHOWN}|g" \
+ -e "s|@GREP@|${GREP}|g" \
+ -e "s|@MKDIR@|${MKDIR}|g" \
+ -e "s|@RM@|${RM}|g" \
+ -e "s|@SU@|${SU}|g" \
+ -e "s|@TOUCH@|${TOUCH}|g" \
+ ${PKGDIR}/INSTALL > ${INSTALL_FILE}
+ PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL
+
+do-install:
+.for DIR in ${DIRS_TO_BUILD}
+ cd ${WRKSRC}/${DIR} && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${INSTALL_TARGET}
+.endfor
+
+post-install:
+ ${GTAR} zxCf ${PREFIX}/man ${WRKSRC}/doc/man.tar.gz \
+ `${SED} -e "s|^#.*||" ${FILESDIR}/man.server`
+ ${INSTALL_SCRIPT} ${WRKDIR}/pgsql.sh ${PREFIX}/etc/rc.d/pgsql
+ PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/databases/postgresql-server/files/man.server b/databases/postgresql-server/files/man.server
new file mode 100644
index 00000000000..b1bccc40072
--- /dev/null
+++ b/databases/postgresql-server/files/man.server
@@ -0,0 +1,4 @@
+# $NetBSD: man.server,v 1.1.1.1 2001/05/14 14:50:26 jlam Exp $
+#
+man1/postgres.1
+man1/postmaster.1
diff --git a/databases/postgresql-server/files/pgsql.sh b/databases/postgresql-server/files/pgsql.sh
new file mode 100644
index 00000000000..cfd658176c7
--- /dev/null
+++ b/databases/postgresql-server/files/pgsql.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# $NetBSD: pgsql.sh,v 1.1.1.1 2001/05/14 14:50:26 jlam Exp $
+#
+# PostgreSQL database rc.d control script
+#
+# PROVIDE: pgsql
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+name="pgsql"
+rcvar=$name
+pgsql_user="@PGUSER@"
+command="@PREFIX@/bin/pg_ctl"
+command_args="-s -D @PGHOME@/data -l @PGHOME@/errlog"
+
+# pgsql_flags contains options for the PostgreSQL postmaster.
+# See postmaster(1) for possible options.
+#
+#pgsql_flags="-i" # allows TCP/IP connections
+#pgsql_flags="-i -l" # enables SSL connections (TCP/IP required)
+
+pgsql_doit()
+{
+ action=$1
+ if [ -n "${pgsql_flags}" ]
+ then
+ command_args="${command_args} -o \"${pgsql_flags}\""
+ fi
+
+ case ${action} in
+ start) echo "Starting ${name}." ;;
+ stop) echo "Stopping ${name}." ;;
+ restart) echo "Restarting ${name}." ;;
+ esac
+
+ @SU@ -m ${pgsql_user} -c "${command} ${command_args} ${action}"
+}
+
+checkyesno()
+{
+ eval _value=\$${1}
+ case $_value in
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0 ;;
+ [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1 ;;
+ *)
+ echo "\$${1} is not set properly."
+ return 1
+ ;;
+ esac
+}
+
+if [ -r /etc/rc.conf ]
+then
+ . /etc/rc.conf
+else
+ eval ${rcvar}=YES
+fi
+
+if checkyesno ${rcvar}
+then
+ cmd=${1:-start}
+
+ if [ -x ${command} ]
+ then
+ case ${cmd} in
+ restart|start|stop|status)
+ ${rcvar}_doit ${cmd}
+ ;;
+ *)
+ echo 1>&2 "Usage: $0 [restart|start|stop|status]"
+ exit 1
+ ;;
+ esac
+ fi
+fi
diff --git a/databases/postgresql-server/pkg/DEINSTALL b/databases/postgresql-server/pkg/DEINSTALL
new file mode 100644
index 00000000000..1d117a35766
--- /dev/null
+++ b/databases/postgresql-server/pkg/DEINSTALL
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# $NetBSD: DEINSTALL,v 1.1.1.1 2001/05/14 14:50:25 jlam Exp $
+#
+
+PKGNAME=$1
+STAGE=$2
+
+USER="@PGUSER@"
+GROUP="@PGGROUP@"
+PGHOME="@PGHOME@"
+
+CAT="@CAT@"
+RM="@RM@"
+
+case ${STAGE} in
+DEINSTALL)
+ ;;
+
+POST-DEINSTALL)
+ ${CAT} << EOF
+===========================================================================
+If you won't be using ${PKGNAME} any longer, you may want
+to remove:
+
+ * the \`${USER}' user
+
+ * the \`${GROUP}' group
+
+ * the following directories:
+
+ ${PGHOME}
+===========================================================================
+EOF
+ ;;
+
+*)
+ echo "Unexpected argument: ${STAGE}"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/databases/postgresql-server/pkg/DESCR b/databases/postgresql-server/pkg/DESCR
new file mode 100644
index 00000000000..4c4fc0ee9f0
--- /dev/null
+++ b/databases/postgresql-server/pkg/DESCR
@@ -0,0 +1,9 @@
+PostgreSQL is a robust, next-generation, Object-Relational DBMS (ORDBMS),
+derived from the Berkeley Postgres database management system. While
+PostgreSQL retains the powerful object-relational data model, rich data types
+and easy extensibility of Postgres, it replaces the PostQuel query language
+with an extended subset of SQL.
+
+PostgreSQL is free and the complete source is available.
+
+This package contains the database server programs.
diff --git a/databases/postgresql-server/pkg/INSTALL b/databases/postgresql-server/pkg/INSTALL
new file mode 100644
index 00000000000..0b6dd0b213e
--- /dev/null
+++ b/databases/postgresql-server/pkg/INSTALL
@@ -0,0 +1,81 @@
+#!/bin/sh
+#
+# $NetBSD: INSTALL,v 1.1.1.1 2001/05/14 14:50:25 jlam Exp $
+
+PKGNAME=$1
+STAGE=$2
+
+USER=@PGUSER@
+GROUP=@PGGROUP@
+PGHOME=@PGHOME@
+
+ADDUSER="@ADDUSER@"
+ADDGROUP="@ADDGROUP@"
+CAT="@CAT@"
+CHGRP="@CHGRP@"
+CHOWN="@CHOWN@"
+GREP="@GREP@"
+MKDIR="@MKDIR@"
+RM="@RM@"
+SU="@SU@"
+TOUCH="@TOUCH@"
+
+case ${STAGE} in
+PRE-INSTALL)
+ ${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.
+ #
+ ${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..."
+ ${ADDGROUP} ${GROUP}
+ echo "Done."
+ fi
+ ${RM} -f "/tmp/grouptest.$$"
+
+ # Use `finger' to be able to use NIS.
+ #
+ finger ${USER} 2>&1 | ${GREP} -q "no such user"
+ if [ $? -eq 0 ]
+ then
+ echo "Creating '${USER}' user..."
+ ${ADDUSER} \
+ -c "PostgreSQL database administrator" \
+ -d ${PGHOME} \
+ -g ${GROUP} \
+ -s /bin/sh \
+ ${USER}
+ ${RM} -f ${PGHOME}/.profile
+ echo "Done."
+ else
+ echo "User '${USER}' already exists...proceeding."
+ fi
+ ${MKDIR} ${PGHOME}
+ ${CHOWN} -R ${USER}:${GROUP} ${PGHOME}
+ ;;
+
+POST-INSTALL)
+ ${CAT} << EOF
+------------------------------------------------------------------
+Initializing PostgreSQL Databases - this may take a few minutes...
+------------------------------------------------------------------
+EOF
+ ${SU} -m ${USER} -c "${PKG_PREFIX}/bin/initdb -D ${PGHOME}/data"
+ ;;
+
+*)
+ echo "Unexpected argument: ${STAGE}"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/databases/postgresql-server/pkg/MESSAGE b/databases/postgresql-server/pkg/MESSAGE
new file mode 100644
index 00000000000..8011bf83fba
--- /dev/null
+++ b/databases/postgresql-server/pkg/MESSAGE
@@ -0,0 +1,23 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2001/05/14 14:50:25 jlam Exp $
+
+PostgreSQL has a Web site at http://www.postgresql.org/ which carries
+details on the latest release, upcoming features, and other information to
+make your work or play with PostgreSQL more productive.
+
+Please check the following URL for a listing of the current user-support
+mailing lists:
+
+ http://www.postgresql.org/ -> Info Central -> Mailing Lists
+
+All of the mailing lists are currently archived and viewable at:
+
+ http://www.postgresql.org/ -> Info Central -> Mailing Lists
+
+And optionally, please connect to the following registration URL:
+
+ http://www.postgresql.org/ -> Helping Us -> Survey/Register
+
+Thank you for choosing PostgreSQL, the most advanced open source database
+engine.
+===========================================================================
diff --git a/databases/postgresql-server/pkg/PLIST b/databases/postgresql-server/pkg/PLIST
new file mode 100644
index 00000000000..f8feb43dc0c
--- /dev/null
+++ b/databases/postgresql-server/pkg/PLIST
@@ -0,0 +1,14 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2001/05/14 14:50:25 jlam Exp $
+bin/postgres
+bin/postmaster
+etc/rc.d/pgsql
+man/man1/postgres.1
+man/man1/postmaster.1
+share/postgresql/global.bki
+share/postgresql/global.description
+share/postgresql/pg_hba.conf.sample
+share/postgresql/pg_ident.conf.sample
+share/postgresql/postgresql.conf.sample
+share/postgresql/template1.bki
+share/postgresql/template1.description
+@unexec rmdir -p %D/share/postgresql 2>/dev/null || true