[csw-devel] SF.net SVN: gar:[6847] csw/mgar/pkg/postgresql/trunk

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Tue Oct 13 13:48:57 CEST 2009


Revision: 6847
          http://gar.svn.sourceforge.net/gar/?rev=6847&view=rev
Author:   dmichelsen
Date:     2009-10-13 11:48:57 +0000 (Tue, 13 Oct 2009)

Log Message:
-----------
posgresql: Start converting legacy scripts to GAR

Modified Paths:
--------------
    csw/mgar/pkg/postgresql/trunk/Makefile

Added Paths:
-----------
    csw/mgar/pkg/postgresql/trunk/checksums
    csw/mgar/pkg/postgresql/trunk/files/README-CSW.txt
    csw/mgar/pkg/postgresql/trunk/files/cswpostgres
    csw/mgar/pkg/postgresql/trunk/files/cswusergroup
    csw/mgar/pkg/postgresql/trunk/files/postgresql.conf

Property Changed:
----------------
    csw/mgar/pkg/postgresql/trunk/


Property changes on: csw/mgar/pkg/postgresql/trunk
___________________________________________________________________
Modified: svn:externals
   - gar https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/gar/v1

   + gar https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/gar/v2


Modified: csw/mgar/pkg/postgresql/trunk/Makefile
===================================================================
--- csw/mgar/pkg/postgresql/trunk/Makefile	2009-10-13 11:45:16 UTC (rev 6846)
+++ csw/mgar/pkg/postgresql/trunk/Makefile	2009-10-13 11:48:57 UTC (rev 6847)
@@ -1,16 +1,68 @@
-GARNAME = package
-GARVERSION = 1.0
-CATEGORIES = category
+GARNAME = postgresql
+GARVERSION = 8.4.1
+CATEGORIES = apps
 
-DESCRIPTION = Brief description
+DESCRIPTION = An advanced open source database
 define BLURB
-  Long description
 endef
 
-MASTER_SITES = 
-DISTFILES  = $(GARNAME)-$(GARVERSION).tar.gz
-DISTFILES += $(call admfiles,CSWpackage,)
+MASTER_SITES = http://wwwmaster.postgresql.org/redir/53/h/source/v$(GARVERSION)/
+DISTFILES  = $(GARNAME)-$(GARVERSION).tar.bz2
+DISTFILES += cswpostgres
+DISTFILES += cswusergroup
+DISTFILES += postgresql.conf
+DISTFILES += README-CSW.txt
 
+PACKAGES = CSWpostgresql CSWpostgresqldoc CSWpostgresqldevel CSWlibpq
+
+CATALOGNAME_CSWpostgresql      = postgresql
+CATALOGNAME_CSWpostgresqldoc   = postgresql_doc
+CATALOGNAME_CSWpostgresqldevel = postgresql_devel
+CATALOGNAME_CSWlibpq           = libpq
+
+SPKG_DESC_CSWpostgresql = An advanced open source database
+SPKG_DESC_CSWpostgresqldoc = PostgreSQL Documentation
+SPKG_DESC_CSWpostgresqldevel = PostgreSQL Developer Files
+SPKG_DESC_CSWlibpq = PostgreSQL Libraries
+
+SPKG_SOURCEURL = http://www.postgresql.org/
+
+REQUIRED_PKGS_CSWpostgresql = CSWreadline CSWzlib CSWlibpq
+REQUIRED_PKGS_CSWpostgresqldevel = CSWpostgresql
+
+LICENSE = COPYRIGHT
+
+prefix = $(BUILD_PREFIX)/postgresql
+docdir = $(BUILD_PREFIX)/share/doc
+
+EXTRA_INC = $(BUILD_PREFIX)/include
+EXTRA_LIB = $(BUILD_PREFIX)/lib
+
+BUILD64 = 1
 CONFIGURE_ARGS = $(DIRPATHS)
 
+TEST_TARGET = check
+
+EXTRA_PAX_ARGS = -s ",^\./opt/csw/postgresql/share/doc,./opt/csw/share/doc/postgresql,p"
+
+PKGFILES_CSWpostgresqldoc = $(PKGFILES_DOC)
+PKGFILES_CSWpostgresqldevel = $(PKGFILES_DEVEL)
+PKGFILES_CSWlibpq = $(PKGFILES_RT)
+
+# -> TODO: start in rc3.d S10, Stop everywhere else in K90
+INITSMF = /etc/init.d/cswpostgres
+
+# -> TODO: Migrate /opt/csw/var/pgdata to /var/opt/csw/postgresql/pgdata
+USERGROUP = /opt/csw/etc/pkg/postgresql
+
+# -> TODO: Migrate /opt/csw/etc/postgresql.conf to /etc/opt/csw/postgresql.conf
+PRESERVECONF = /opt/csw/etc/postgresql.conf
+
 include gar/category.mk
+
+post-merge:
+	ginstall -d $(PKGROOT)/etc/init.d && ginstall $(WORKDIR)/cswpostgres $(PKGROOT)/etc/init.d/
+	ginstall -d $(PKGROOT)/opt/csw/etc/pkg/postgresql && ginstall $(WORKDIR)/cswusergroup $(PKGROOT)/opt/csw/etc/pkg/postgresql/
+	ginstall -d $(PKGROOT)/opt/csw/etc && ginstall $(WORKDIR)/postgresql.conf $(PKGROOT)/opt/csw/etc/
+	ginstall -d $(PKGROOT)$(docdir)/postgresql/ && ginstall $(WORKDIR)/README-CSW.txt $(PKGROOT)$(docdir)/postgresql/
+	@$(MAKECOOKIE)

Added: csw/mgar/pkg/postgresql/trunk/checksums
===================================================================
--- csw/mgar/pkg/postgresql/trunk/checksums	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/checksums	2009-10-13 11:48:57 UTC (rev 6847)
@@ -0,0 +1,5 @@
+45613fd5367cd230505ad68feb9ad634  README-CSW.txt
+6916c5b1a6e1285c6a564abf4b659697  cswpostgres
+443171cc5303a8ea0f0a13cbb5e32189  cswusergroup
+f2015af17bacbbfe140daf0d1067f9c9  postgresql-8.4.1.tar.bz2
+121c45f17350191ca5676453c25716da  postgresql.conf

Copied: csw/mgar/pkg/postgresql/trunk/files/README-CSW.txt (from rev 6825, csw/mgar/pkg/postgresql/trunk/legacy/postgresql/README-CSW.txt.sparc)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/README-CSW.txt	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/README-CSW.txt	2009-10-13 11:48:57 UTC (rev 6847)
@@ -0,0 +1,103 @@
+*** Important information - please make sure you read this ! ***
+
+*** Migrating from older versions ***
+
+If you have upgraded from a previous 8.0, 8.1 or 8.2 version of PostgreSQL, 
+your databases will NOT work on this 8.3.x version. Before upgrading, you 
+should dump your databases using the old utilities. You can then create a
+new data directory using this 8.3.x package, and import your dumps. 
+See the "64-bit support" section below for pointers to documentation on t
+his.
+
+Another point to note is that the location of the PostgreSQL install has 
+changed. Previous 7.3.x packages used /opt/csw as the base - this package 
+uses /opt/csw/postgresql. You will need to add /opt/csw/postgresql/bin to your
+$PATH, and any scripts you have written using the old locations will have to
+be changed.
+
+
+*** User configuration of server options ***
+
+Configuration of the server start-up options is now done through a user-
+configuration file, /opt/csw/etc/postgresql.conf. A sample template has been
+provided for you at /opt/csw/etc/postgresql.conf.csw. If you want to change
+any of the server options discussed below, make a copy of this file to 
+/opt/csw/etc/postgresql.conf and edit it accordingly.
+
+If you cannot modify this file (for instance, you are mounting /opt/csw
+from a read-only NFS server), you can use /etc/opt/csw/postgresql.conf 
+instead, and it will take precedence over /opt/csw/etc/postgresql.conf.
+
+*** Networking ***
+
+By default, the cswpostgres init script will start the server up listening on
+localhost only. If you want to allow other hosts on your network to connect, you
+will need to add "-o -i" to the value of SERVEROPTS in the user configuration
+file and restart your server. The included template has the line already
+entered, you just need to uncomment it (remove the leading #).
+
+Once this is done, PostgreSQL will now bind to all network interfaces and
+listen for connections. You will still need to configure which hosts are allowed
+access by modifying the pg_hba.conf file in your data directory - read the manual
+for more information on this.
+
+*** 64-bit support ***
+
+The SPARC packages have been built with 64-bit support, but by default, the
+32-bit version of the server will be run. If you need the 64-bit version,
+edit the user configuration file and change the values of PGINIT and PGCTL
+accordingly.
+
+It is important to note that the 64-bit server WILL NOT WORK with databases
+created with the 32-bit version, and vice versa. You will get an error
+message if you attempt this.
+
+In order to migrate your system to the 64-bit server, you will need to dump
+your databases while running the 32-bit client, stop and upgrade the server,
+initialise a new database directory, and import your dumps. For more information
+on this procedure, see the PostgreSQL manual (included with this package),
+chapter 9 - Backup and restore. This is located at :
+
+/opt/csw/postgresql/share/doc/html/backup.html
+
+All other PostgreSQL binaries in /opt/csw/postgresql/bin/ are copies of the 
+'isaexec' wrapper, which will run the appropriate binary for your
+architecture and/or kernel.
+
+*** Starting the server ***
+
+The PostgreSQL database runs under the user 'postgres' - this has been created 
+for you by the installation script.
+
+The default PostgreSQL data directory is /opt/csw/var/pgdata. As this does not 
+exist, you will need to create it yourself before the database will start.
+You can change the location of the data directory by altering the user
+configuration file, and modifying the value of PGDATA.
+
+A startup script has been provided for you that handles database initialisation,
+startup and shutdown functions - it is located at /etc/init.d/cswpostgres. You
+should always use this script to start or stop the server, otherwise you may 
+find that you are running the wrong binaries (64-bit instead of 32-bit).
+ 
+It is set to start the database the next time the system enters runlevel 3 - 
+usually, this will be at the next boot. 
+
+To create the data directory, the startup script accepts the "init" argument :
+
+/etc/init.d/cswpostgres init
+
+This will create and initialise the data directory. After this step has been
+completed succesfully, the database can be started with :
+
+/etc/init.d/cswpostgres start
+
+If you get errors relating to shared memory on startup, make sure you have read 
+the section entitled "Manging Kernel Resources" - this is in Chapter 3 of the 
+PostgreSQL HTML Administrator's Guide, located at 
+
+/opt/csw/postgresql/share/doc/html/index.html 
+
+
+Mark Round,
+mark at blastwave.org
+

Copied: csw/mgar/pkg/postgresql/trunk/files/cswpostgres (from rev 6825, csw/mgar/pkg/postgresql/trunk/legacy/postgresql/cswpostgres.sparc)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/cswpostgres	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/cswpostgres	2009-10-13 11:48:57 UTC (rev 6847)
@@ -0,0 +1,97 @@
+#!/bin/sh
+# PostgreSQL startup script - part of the CSWpostgresql package
+# mark at blastwave.org
+
+# Read in the user configuration file
+[ -s /opt/csw/etc/postgresql.conf ] && . /opt/csw/etc/postgresql.conf
+[ -s /etc/opt/csw/postgresql.conf ] && . /etc/opt/csw/postgresql.conf
+
+# Defaults
+[ -z "$PGDATA" ] && PGDATA=/opt/csw/var/pgdata
+[ -z "$PGCTL" ] && PGCTL=/opt/csw/postgresql/bin/sparcv8/pg_ctl
+[ -z "$PGINIT" ] && PGINIT=/opt/csw/postgresql/bin/sparcv8/initdb
+
+
+# The following attempts to catch any mistakes in the server
+# version - it checks if the 64-bit server was last run. If so,
+# it forces the 64-bit server, otherwise it won't start up!
+# And vice-versa for the 32-bit server...
+if [ -f $PGDATA/postmaster.opts ]; then
+  grep 'sparcv9' $PGDATA/postmaster.opts > /dev/null
+  if [ $? -eq 0 ]; then
+    echo $PGCTL | grep "sparcv8" > /dev/null
+    if [ $? -eq 0 ]; then
+      echo "Warning: 32-bit server was specified in /etc/init.d/cswpostgres,"
+      echo "         but 64-bit version was last run. Using 64-bit server..."
+    fi
+    PGCTL=/opt/csw/postgresql/bin/sparcv9/pg_ctl
+    PGINIT=/opt/csw/postgresql/bin/sparcv9/initdb
+  else
+    # Did not detect 64-bit server last used
+    echo $PGCTL | grep "sparcv8" > /dev/null
+    if [ $? -ne 0 ]; then
+      echo "Warning: 64-bit server was specified in /etc/init.d/cswpostgres,"
+      echo "         but 32-bit version was last run. Using 32-bit server..."
+    fi
+    PGCTL=/opt/csw/postgresql/bin/sparcv8/pg_ctl
+    PGINIT=/opt/csw/postgresql/bin/sparcv8/initdb
+  fi
+fi
+
+# Exit if postgres user hasn't been created.
+grep '^postgres:' /etc/passwd >/dev/null
+if [ $? -ne 0 ] ; then
+        getent passwd postgres >/dev/null
+        if [ $? -ne 0 ] ; then
+               exit 0
+        fi
+fi
+
+# Change to /var/tmp, as pgctl etc. need to be started from
+# a directory that they can read
+cd /var/tmp
+
+case "$1" in
+start)
+      if [ -d $PGDATA -a `ls -l $PGDATA 2> /dev/null | wc -l` -gt 1 ]; then
+         # PostgreSQL data directory exists and is populated
+         echo "Starting PostgreSQL..."
+         su postgres -c "$PGCTL -D $PGDATA -l $PGDATA/postgresql.log start $SERVEROPTS"
+      fi
+      ;;
+
+stop)
+     echo "Stopping PostgreSQL database..."
+     su postgres -c "$PGCTL -D $PGDATA -l $PGDATA/postgresql.log stop"
+     ;;
+
+restart)
+     echo "Restarting PostgreSQL database..."
+     su postgres -c "$PGCTL -D $PGDATA -l $PGDATA/postgresql.log restart $SERVEROPTS"
+     ;;
+
+reload)
+     echo "Reloading PostgreSQL database..."
+     su postgres -c "$PGCTL -D $PGDATA -l $PGDATA/postgresql.log reload $SERVEROPTS"
+     ;;
+
+status)
+     su postgres -c "$PGCTL -D $PGDATA status"
+     ;;
+
+init)
+     # create and initialise data directory
+     echo "Creating PostgreSQL data directory at $PGDATA..."
+     # Create it, unless it's already there and empty
+     [ -d $PGDATA -a `ls -l $PGDATA 2> /dev/null | wc -l` -eq 1 ] || mkdir -p $PGDATA
+     chown postgres $PGDATA
+     echo "Initialising PostgreSQL database..."
+     su postgres -c "$PGINIT -D $PGDATA > /dev/null"
+     ;;
+
+*)
+     echo "Usage: $0 (init|start|stop|restart|reload|status)"
+     ;;
+
+esac
+

Added: csw/mgar/pkg/postgresql/trunk/files/cswusergroup
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/cswusergroup	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/cswusergroup	2009-10-13 11:48:57 UTC (rev 6847)
@@ -0,0 +1 @@
+postgres::CSW Postgres:/opt/csw/var/pgdata:/bin/sh::

Copied: csw/mgar/pkg/postgresql/trunk/files/postgresql.conf (from rev 6825, csw/mgar/pkg/postgresql/trunk/legacy/postgresql/postgresql.conf.sparc)
===================================================================
--- csw/mgar/pkg/postgresql/trunk/files/postgresql.conf	                        (rev 0)
+++ csw/mgar/pkg/postgresql/trunk/files/postgresql.conf	2009-10-13 11:48:57 UTC (rev 6847)
@@ -0,0 +1,34 @@
+# Example PostgreSQL server configuration file.
+# Provided by the Blastwave package of PostgreSQL.
+# This file is read by the /etc/init.d/cswpostgres startup script,
+# and can be used to override the defaults.
+
+# The location of the data directory.
+# Default : /opt/csw/var/pgdata
+PGDATA=/opt/csw/var/pgdata
+
+
+# Which binaries to use, 32- or 64-bit.
+# Only use the 64-bit server if you're sure you need it.
+# Make sure you have read /opt/csw/postgresql/share/doc/README-CSW.txt
+# before changing these, as your databases may not work without
+# a 'dump and restore' cycle !
+
+# 32-bit server - default, and fine for most uses
+PGCTL=/opt/csw/postgresql/bin/sparcv8/pg_ctl
+PGINIT=/opt/csw/postgresql/bin/sparcv8/initdb
+
+# 64-bit server - uncomment these lines only if you really need them.
+#PGCTL=/opt/csw/postgresql/bin/sparcv9/pg_ctl
+#PGINIT=/opt/csw/postgresql/bin/sparcv9/initdb
+
+
+# Additional options to pass to postmaster.
+# These options will be passed to the postmaster program. The most common use of
+# these is to allow network access to PostgreSQL from other hosts over TCP/IP.
+# This is done by using the flags "-o -i", as in the example below.
+# Uncomment this line to enable network access to PostgreSQL.
+# Note that you will still need to configure authentication in the pg_hba.conf
+# in your data directory.
+# SERVEROPTS="-o -i"
+


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list