[csw-devel] SF.net SVN: gar:[11049] csw/mgar/pkg/postgresql/branches/postgresql-9.0

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Sep 24 06:16:42 CEST 2010


Revision: 11049
          http://gar.svn.sourceforge.net/gar/?rev=11049&view=rev
Author:   wahwah
Date:     2010-09-24 04:16:42 +0000 (Fri, 24 Sep 2010)

Log Message:
-----------
postgresql: Work in progress. Porting the Ubuntu package. Merged some of the changes made by Dago.

Modified Paths:
--------------
    csw/mgar/pkg/postgresql/branches/postgresql-9.0/Makefile
    csw/mgar/pkg/postgresql/branches/postgresql-9.0/checksums
    csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-84.postinstall
    csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/README-CSW.txt
    csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/cswpostgres.tmpl

Added Paths:
-----------
    csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-90.postinstall

Modified: csw/mgar/pkg/postgresql/branches/postgresql-9.0/Makefile
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-9.0/Makefile	2010-09-24 04:07:08 UTC (rev 11048)
+++ csw/mgar/pkg/postgresql/branches/postgresql-9.0/Makefile	2010-09-24 04:16:42 UTC (rev 11049)
@@ -1,6 +1,8 @@
 # Copyright 2009 OpenCSW
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
+#
+# Based on the Ubuntu PostgreSQL package.
 
 # This BUILD is NOT READY!  It needs work before it's usable.
 
@@ -14,18 +16,17 @@
 # example of it.   (gmake repackage may produce the right output)
 
 GARNAME = postgresql
-BASE_VERSION = 8.4
+BASE_VERSION = 9.0
 # How to make one automatically?
-VERSION_NODOT = 8_4
-BASE_VERSION_G = 84
-PATCHLEVEL = 4
+VERSION_NODOT = 9_0
+BASE_VERSION_G = 90
+PATCHLEVEL = 0
 GARVERSION = $(BASE_VERSION).$(PATCHLEVEL)
 CATEGORIES = apps
 
 # Useful when making a series of builds on the same day
 # GARFLAVOR ?= DBG
 
-DESCRIPTION = An advanced open source database
 SPKG_SOURCEURL = http://www.postgresql.org/
 
 define BLURB
@@ -40,12 +41,12 @@
 # libdir = $(prefix)$(version_dependent)/lib
 # Otherwise initdb can't find the right libraries, see:
 # http://archives.postgresql.org/pgsql-general/2010-01/msg00422.php
-libdir = $(abspath $(prefix)$(version_dependent)/$(MM_LIBDIR))
+libdir = $(abspath $(prefix)$(version_dependent)/lib/$(MM_LIBDIR))
 localstatedir = /var$(prefix)/$(GARNAME)/$(BASE_VERSION)
-sysconfdir = /etc$(prefix)/$(GARNAME)/$(BASE_VERSION)
+sysconfdir = /etc$(prefix)/postgresql-common
 datadir = $(prefix)/share/$(GARNAME)/$(BASE_VERSION)
-docdir = $(prefix)/share/doc/$(GARNAME)-$(BASE_VERSION)
-includedir = $(prefix)/include/$(GARNAME)/$(BASE_VERSION)
+docdir = $(prefix)/share/doc/$(GARNAME)-doc-$(BASE_VERSION)
+includedir = $(prefix)/include/postgresql/
 infodir = $(datadir)/info
 libexecdir_install = $(prefix)/libexec/$(GARNAME)/$(BASE_VERSION)
 lispdir = $(datadir)/emacs/site-lisp
@@ -62,11 +63,11 @@
 DISTFILES += cswusergroup.tmpl
 DISTFILES += postgresql.conf.tmpl
 DISTFILES += README-CSW.txt
-# DISTFILES += CSWpostgresql-$(BASE_VERSION_G).postinstall
-include files/CSWpostgresql-$(BASE_VERSION_G).postinstall
+DISTFILES += CSWpostgresql-$(BASE_VERSION_G).postinstall
 
 PACKAGES += CSWpostgresql
-PACKAGES += CSWlibpq-$(BASE_VERSION_G)
+PACKAGES += CSWlibpq
+PACKAGES += CSWlibpq-devel
 PACKAGES += CSWpostgresql-$(BASE_VERSION_G)
 PACKAGES += CSWpostgresql-$(BASE_VERSION_G)-dev
 PACKAGES += CSWpostgresql-$(BASE_VERSION_G)-doc
@@ -74,37 +75,37 @@
 CATALOGNAME_CSWpostgresql-$(BASE_VERSION_G)      = postgresql_$(BASE_VERSION_G)
 CATALOGNAME_CSWpostgresql-$(BASE_VERSION_G)-doc  = postgresql_$(BASE_VERSION_G)_doc
 CATALOGNAME_CSWpostgresql-$(BASE_VERSION_G)-dev  = postgresql_$(BASE_VERSION_G)_devel
-CATALOGNAME_CSWlibpq-$(BASE_VERSION_G)           = libpq$(BASE_VERSION_G)
+CATALOGNAME_CSWlibpq                             = libpq
 CATALOGNAME_CSWpostgresql                        = postgresql
 
 SPKG_DEST_CSWpostgresql                       = An advanced open source database, a metapackage
 SPKG_DESC_CSWpostgresql-$(BASE_VERSION_G)     = An advanced open source database, version $(BASE_VERSION).x
 SPKG_DESC_CSWpostgresql-$(BASE_VERSION_G)-doc = PostgreSQL $(BASE_VERSION).x Documentation
 SPKG_DESC_CSWpostgresql-$(BASE_VERSION_G)-dev = PostgreSQL $(BASE_VERSION).x Developer Files
-SPKG_DESC_CSWlibpq-$(BASE_VERSION_G)          = PostgreSQL $(BASE_VERSION).x Libraries
+SPKG_DESC_CSWlibpq                            = PostgreSQL C client library (built from $(BASE_VERSION).x sources)
+SPKG_DESC_CSWlibpq-devel                      = PostgreSQL C client headers (built from $(BASE_VERSION).x sources)
 
 RUNTIME_DEP_PKGS_CSWpostgresql                        = CSWpostgresql-$(BASE_VERSION_G)
 RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWkrb5lib
 RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibgnugetopt
-RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibpq-$(BASE_VERSION_G)
+RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibpq
 RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibxml2
 RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWlibxslt
 RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWosslrt
 RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWreadline
 RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)     += CSWzlib
-RUNTIME_DEP_PKGS_CSWlibpq-$(BASE_VERSION_G)          += CSWkrb5lib
-RUNTIME_DEP_PKGS_CSWlibpq-$(BASE_VERSION_G)          += CSWlibxml2
-RUNTIME_DEP_PKGS_CSWlibpq-$(BASE_VERSION_G)          += CSWlibxslt
-RUNTIME_DEP_PKGS_CSWlibpq-$(BASE_VERSION_G)          += CSWosslrt
-RUNTIME_DEP_PKGS_CSWlibpq-$(BASE_VERSION_G)          += CSWzlib
+RUNTIME_DEP_PKGS_CSWlibpq                            += CSWkrb5lib
+RUNTIME_DEP_PKGS_CSWlibpq                            += CSWlibxml2
+RUNTIME_DEP_PKGS_CSWlibpq                            += CSWlibxslt
+RUNTIME_DEP_PKGS_CSWlibpq                            += CSWosslrt
+RUNTIME_DEP_PKGS_CSWlibpq                            += CSWzlib
 RUNTIME_DEP_PKGS_CSWpostgresql-$(BASE_VERSION_G)-dev  = CSWpostgresql-$(BASE_VERSION_G)
 
-CHECKPKG_OVERRIDES_CSWpostgresql += surplus-dependency|CSWpostgresql-84
-CHECKPKG_OVERRIDES_CSWpostgresql-84-dev += surplus-dependency|CSWpostgresql-84
+CHECKPKG_OVERRIDES_CSWpostgresql += surplus-dependency|CSWpostgresql-90
+CHECKPKG_OVERRIDES_CSWpostgresql-90-dev += surplus-dependency|CSWpostgresql-90
 
 ARCHALL_CSWpostgresql                       = 1
 ARCHALL_CSWpostgresql-$(BASE_VERSION_G)-doc = 1
-ARCHALL_CSWpostgresql-$(BASE_VERSION_G)-doc = 1
 
 LICENSE = COPYRIGHT
 
@@ -154,18 +155,45 @@
 SKIPTEST ?= 1
 TEST_TARGET = check
 
-PKGFILES_CSWpostgresql                        = $(prefix)/bin/.*
+PKGFILES_CSWpostgresql                        = NOFILES
 PKGFILES_CSWpostgresql-$(BASE_VERSION_G)-doc  = $(PKGFILES_DOC)
-PKGFILES_CSWpostgresql-$(BASE_VERSION_G)-doc += $(prefix)/share/doc.*
 PKGFILES_CSWpostgresql-$(BASE_VERSION_G)-dev  = $(PKGFILES_DEVEL)
-PKGFILES_CSWlibpq-$(BASE_VERSION_G)           = $(PKGFILES_RT)
-PKGFILES_CSWlibpq-$(BASE_VERSION_G)          += $(libdir)/64
-PKGFILES_CSWlibpq-$(BASE_VERSION_G)          += $(libdir).*lib(pq|pgtypes|ecpg)\.so.*
 
+PKGFILES_CSWlibpq  = $(call baseisadirs,$(libdir),libpq\.so(\.\d+)*)
+PKGFILES_CSWlibpq += $(call baseisadirs,$(libpath_install),libpq\.so(\.\d+)*)
+PKGFILES_CSWlibpq += $(libdir)/64
+
+#
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/internal/.*
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/libpq-fe.h
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/libpq-events.h
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/libpq/libpq-fs.h
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/pg_config.*.h
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/postgres_ext.h
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/8.4/server/catalog/pg_type.h /usr/include/postgresql/catalog
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/8.4/server/catalog/genbki.h /usr/include/postgresql/catalog
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/8.4/server/nodes/nodes.h /usr/include/postgresql/nodes
+# PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/8.4/server/utils/(elog|errcodes|palloc).h /usr/include/postgresql/utils
+# Need to move these.
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/utils/(elog|errcodes|palloc).h
+# PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/8.4/server/{c,pg_config,pg_config_manual,pg_config_os,port,pg_trace}.h /usr/include/postgresql/
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/(c|pg_config|pg_config_manual|pg_config_os|port|pg_trace}.h
+# PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/8.4/server/postgres{,_fe,_ext}.h /usr/include/postgresql/
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/postgres(|_fe|_ext}.h
+# PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/8.4/server/mb/pg_wchar.h /usr/include/postgresql/mb
+PKGFILES_CSWlibpq-devel += $(prefix)/include/postgresql/mb/pg_wchar.h
+PKGFILES_CSWlibpq-devel += $(prefix)/lib/libpq.so
+# PKGFILES_CSWlibpq-devel += $(prefix)/lib/postgresql/8.4/bin/pg_config usr/bin
+# Needs to be moved
+PKGFILES_CSWlibpq-devel += $(prefix)/bin/pg_config
+PKGFILES_CSWlibpq-devel += $(prefix)/share/postgresql/8.4/man/man1/pg_config.1
+PKGFILES_CSWlibpq-devel += $(prefix)/share/locale/*/LC_MESSAGES/pg_config-8.4.mo
+
+
 # initscript_base_name = cswpostgres_$(subst .,_,$(BASE_VERSION))
 initscript_base_name = cswpostgres_$(VERSION_NODOT)
 INITSMF = /etc$(prefix)/init\.d/$(initscript_base_name)
-USERGROUP = /etc/opt/csw/pkg/postgresql/cswusergroup_$(VERSION_NODOT)
+USERGROUP = /etc$(prefix)/pkg/postgresql/cswusergroup_$(VERSION_NODOT)
 PRESERVECONF = $(sysconfdir)/postgresql\.conf
 
 BIN_NAMES  = clusterdb
@@ -203,6 +231,25 @@
 PROTOTYPE_PERMS_pgdata = 0700
 PROTOTYPE_CLASS_pgdata = ugfiles
 
+EXPANDVARS  = CSWpostgresql-$(BASE_VERSION_G).postinstall
+EXPANDVARS += cswpostgres.tmpl
+# This is one of the rare cases where a protoype filter is needed.
+# Do not copy this for other Makefiles unless you understand exactly what it does!!
+# (explanation: It adds -isaexec to the isaexec-name of the binaries to be isaexec'ed)
+PROTOTYPE_FILTER = perl -npe 's,=/opt/csw/bin/isaexec,-isaexec=/opt/csw/bin/isaexec,'
+
+# ISAEXEC_FILES = $(addsuffix -isaexec,$(foreach B,$(BIN_NAMES),$(bindir_install)/$B))
+ALTERNATIVES_CSWpostgresql-$(BASE_VERSION_G) = $(GARNAME)$(BASE_VERSION_G)-32 $(GARNAME)$(BASE_VERSION_G)-64 $(GARNAME)$(BASE_VERSION_G)-auto
+ALTERNATIVE_$(GARNAME)$(BASE_VERSION_G)-32 = $(bindir_install)/$(firstword $(BIN_NAMES)) $(firstword $(BIN_NAMES)) $(bindir_install)/$(ISA_DEFAULT)/$(firstword $(BIN_NAMES)) 100
+ALTERNATIVE_$(GARNAME)$(BASE_VERSION_G)-32 += $(foreach B,$(wordlist 2,$(words $(BIN_NAMES)),$(BIN_NAMES)),$(bindir_install)/$B $B $(bindir_install)/$(ISA_DEFAULT)/$B)
+ALTERNATIVE_$(GARNAME)$(BASE_VERSION_G)-64 = $(bindir_install)/$(firstword $(BIN_NAMES)) $(firstword $(BIN_NAMES)) $(bindir_install)/$(ISA_DEFAULT64)/$(firstword $(BIN_NAMES)) 200
+ALTERNATIVE_$(GARNAME)$(BASE_VERSION_G)-64 += $(foreach B,$(wordlist 2,$(words $(BIN_NAMES)),$(BIN_NAMES)),$(bindir_install)/$B $B $(bindir_install)/$(ISA_DEFAULT64)/$B)
+ALTERNATIVE_$(GARNAME)$(BASE_VERSION_G)-auto = $(bindir_install)/$(firstword $(BIN_NAMES)) $(firstword $(BIN_NAMES)) $(bindir_install)/$(firstword $(BIN_NAMES))-isaexec 300
+ALTERNATIVE_$(GARNAME)$(BASE_VERSION_G)-auto += $(foreach B,$(wordlist 2,$(words $(BIN_NAMES)),$(BIN_NAMES)),$(bindir_install)/$B $B $(bindir_install)/$B-isaexec)
+
+# checkpkg does not detect this dependency automatically
+CHECKPKG_OVERRIDES_CSWpostgresql-$(BASE_VERSION_G) += surplus-dependency|CSWalternatives
+
 include gar/category.mk
 
 CFLAGS := $(filter-out -I%,$(CFLAGS))
@@ -213,18 +260,26 @@
 
 post-install-modulated:
 	$(INSTALL_ENV) gmake -C $(WORKSRC)/contrib DESTDIR=$(DESTDIR) install
+	ginstall -d -m 755 $(DESTDIR)$(prefix)/bin
+	[ -r $(DESTDIR)$(bindir)/pg_config ] && \
+	gmv -v $(DESTDIR)$(bindir)/pg_config $(DESTDIR)$(prefix)/bin || true
+	ginstall -d -m 755 $(DESTDIR)/include/postgresql/utils
+	for f in elog.h errcodes.h palloc.h; do \
+		[ -r $(DESTDIR)$(includedir)/utils/$${f} ] && \
+			gmv -v $(DESTDIR)$(includedir)/utils/$${f} \
+			$(DESTDIR)$(prefix)/include/postgresql/utils/ || true; \
+	done
+	for f in c.h pg_config.h pg_config_manual.h pg_config_os,port.h pg_trace.h ; do \
+		[ -f $(DESTDIR)$(prefix)/include/postgresql/8.4/server/$${f} ] && \
+		gmv -v $(DESTDIR)$(prefix)/include/postgresql/8.4/server/$${f} \
+			$(DESTDIR)/$(prefix)/include/postgresql/ || true; \
+	done
 	@$(MAKECOOKIE)
 
 post-merge:
 	ginstall -d $(PKGROOT)/etc$(prefix)/init.d
-	gsed \
-		-e 's+ at PGDATA@+$(PGDATA)+g' \
-		-e 's+ at sysconfdir@+$(sysconfdir)+g' \
-		-e 's+ at bindir@+$(bindir)+g' \
-		< $(FILEDIR)/cswpostgres.tmpl \
-		> $(WORKDIR)/$(initscript_base_name)
 	ginstall \
-		$(WORKDIR)/$(initscript_base_name) \
+		$(WORKDIR)/cswpostgres.tmpl \
 		$(PKGROOT)/etc$(prefix)/init.d/$(initscript_base_name)
 	ginstall -d $(PKGROOT)/etc$(prefix)/pkg/$(GARNAME)
 	gsed -e 's+ at PGDATA@+$(PGDATA)+g' \
@@ -241,9 +296,16 @@
 	ginstall -d $(PKGROOT)$(docdir)
 	# ginstall $(WORKDIR)/README-CSW.txt $(PKGROOT)$(docdir)
 	ginstall -m 755 -d $(PKGROOT)$(prefix)/bin
-	for b in $(BIN_NAMES); do \
-	  gln -s ..$(version_dependent)/bin/$${b} $(PKGROOT)$(prefix)/bin/$${b}; \
-	done
+	# for b in $(BIN_NAMES); do \
+	#   gln -s ..$(version_dependent)/bin/$${b} $(PKGROOT)$(prefix)/bin/$${b}; \
+	# done
 	ginstall -d $(PKGROOT)$(PGDATA)
 	gln -s $(ISA_DEFAULT64) $(PKGROOT)$(libdir)/64
+	for L in $(notdir $(wildcard $(PKGROOT)$(libdir)/libpq.*)); do \
+		gln -s $(pgsubdir)/$$L $(PKGROOT)$(libpath_install)/$$L; \
+	done
+	mkdir -p $(PKGROOT)$(libpath_install)/$(ISA_DEFAULT64)
+	for L in $(notdir $(wildcard $(PKGROOT)$(libdir)/$(ISA_DEFAULT64)/libpq.*)); do \
+		gln -s ../$(pgsubdir)/$(ISA_DEFAULT64)/$$L $(PKGROOT)$(libpath_install)/$(ISA_DEFAULT64)/$$L; \
+	done
 	@$(MAKECOOKIE)

Modified: csw/mgar/pkg/postgresql/branches/postgresql-9.0/checksums
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-9.0/checksums	2010-09-24 04:07:08 UTC (rev 11048)
+++ csw/mgar/pkg/postgresql/branches/postgresql-9.0/checksums	2010-09-24 04:16:42 UTC (rev 11049)
@@ -1 +1 @@
-4bf2448ad965bca3940df648c02194df  postgresql-8.4.4.tar.bz2
+14c2122cc322e69ab2ab702ed7714bbe  postgresql-9.0.0.tar.bz2

Modified: csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-84.postinstall
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-84.postinstall	2010-09-24 04:07:08 UTC (rev 11048)
+++ csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-84.postinstall	2010-09-24 04:16:42 UTC (rev 11049)
@@ -1,41 +1,39 @@
-define CSWpostgresql-84_postinstall
 #!/bin/sh
 # vim:set ft=sh:
 #
-# $$Id$$
+# $Id$
 #
 # Initialize the database cluster if it hasn't been initialized before.
 
 # Read in the user configuration file
 [ -s /opt/csw/etc/postgresql.conf ] && . /opt/csw/etc/postgresql.conf
-[ -s $(sysconfdir)/postgresql.conf ] && . $(sysconfdir)/postgresql.conf
+[ -s @sysconfdir@/postgresql.conf ] && . @sysconfdir@/postgresql.conf
 
-PGDATA=$(PGDATA)
-PGINIT=$(bindir)/initdb
+PGDATA=@PGDATA@
+PGINIT=@bindir@/initdb
 
 initialize_cluster() {
-	chown postgres "$${PGDATA}"
-	chmod 0700 "$${PGDATA}"
+	chown postgres "${PGDATA}"
+	chmod 0700 "${PGDATA}"
 	echo "Initializing PostgreSQL database..."
-	su postgres -c "\"$${PGINIT}\" -D \"$${PGDATA}\" -E utf-8"
+	su postgres -c "\"${PGINIT}\" -D \"${PGDATA}\" -E utf-8"
 }
 
-if [ `ls -l $${PGDATA} 2>/dev/null | wc -l` -eq 1 ]; then
+if [ `ls -l ${PGDATA} 2>/dev/null | wc -l` -eq 1 ]; then
 	initialize_cluster
 else
 	echo "The database cluster seems to be initialized already."
 fi
 
 if [ -x /usr/sbin/svcadm ]; then
-	fmri="cswpostgres_$(VERSION_NODOT)"
-	echo "Enabling the $${fmri} service in SMF"
-	svcadm clear "$${fmri}"
-	svcadm enable "$${fmri}"
+	fmri="cswpostgres_ at VERSION_NODOT@"
+	echo "Enabling the ${fmri} service in SMF"
+	svcadm clear "${fmri}"
+	svcadm enable "${fmri}"
 else
-	initscript="/etc/opt/csw/init.d/cswpostgres_$(VERSION_NODOT)"
-	echo "Issuing $${initscript} start"
-	$${initscript} start
+	initscript="/etc/opt/csw/init.d/cswpostgres_ at VERSION_NODOT@"
+	echo "Issuing ${initscript} start"
+	"${initscript}" start
 fi
 
 exit 0
-endef

Copied: csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-90.postinstall (from rev 11032, csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-84.postinstall)
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-90.postinstall	                        (rev 0)
+++ csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/CSWpostgresql-90.postinstall	2010-09-24 04:16:42 UTC (rev 11049)
@@ -0,0 +1,39 @@
+#!/bin/sh
+# vim:set ft=sh:
+#
+# $Id$
+#
+# Initialize the database cluster if it hasn't been initialized before.
+
+# Read in the user configuration file
+[ -s /opt/csw/etc/postgresql.conf ] && . /opt/csw/etc/postgresql.conf
+[ -s @sysconfdir@/postgresql.conf ] && . @sysconfdir@/postgresql.conf
+
+PGDATA=@PGDATA@
+PGINIT=@bindir@/initdb
+
+initialize_cluster() {
+	chown postgres "${PGDATA}"
+	chmod 0700 "${PGDATA}"
+	echo "Initializing PostgreSQL database..."
+	su postgres -c "\"${PGINIT}\" -D \"${PGDATA}\" -E utf-8"
+}
+
+if [ `ls -l ${PGDATA} 2>/dev/null | wc -l` -eq 1 ]; then
+	initialize_cluster
+else
+	echo "The database cluster seems to be initialized already."
+fi
+
+if [ -x /usr/sbin/svcadm ]; then
+	fmri="cswpostgres_ at VERSION_NODOT@"
+	echo "Enabling the ${fmri} service in SMF"
+	svcadm clear "${fmri}"
+	svcadm enable "${fmri}"
+else
+	initscript="/etc/opt/csw/init.d/cswpostgres_ at VERSION_NODOT@"
+	echo "Issuing ${initscript} start"
+	"${initscript}" start
+fi
+
+exit 0

Modified: csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/README-CSW.txt
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/README-CSW.txt	2010-09-24 04:07:08 UTC (rev 11048)
+++ csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/README-CSW.txt	2010-09-24 04:16:42 UTC (rev 11049)
@@ -1,5 +1,7 @@
 *** Important information - please make sure you read this ! ***
 
+$Id$
+
 *** Migrating from older versions ***
 
 If you have upgraded from a previous 8.0, 8.1 or 8.2 version of PostgreSQL, 

Modified: csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/cswpostgres.tmpl
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/cswpostgres.tmpl	2010-09-24 04:07:08 UTC (rev 11048)
+++ csw/mgar/pkg/postgresql/branches/postgresql-9.0/files/cswpostgres.tmpl	2010-09-24 04:16:42 UTC (rev 11049)
@@ -23,42 +23,10 @@
 
 # Defaults
 [ -z "${PGDATA}" ] && PGDATA=@PGDATA@
-[ -z "${PGCTL}" ] && PGCTL=@bindir@/sparcv8/pg_ctl
-[ -z "${PGINIT}" ] && PGINIT=@bindir@/sparcv8/initdb
+[ -z "${PGCTL}" ] && PGCTL=@bindir@/pg_ctl
+[ -z "${PGINIT}" ] && PGINIT=@bindir@/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...
-#
-# This version doesn't check the i386/amd64 architectures.
-if [ -f "${PGDATA}/postmaster.opts" ]; then
-  if grep 'sparcv9' ${PGDATA}/postmaster.opts > /dev/null; 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=@bindir@/sparcv9/pg_ctl
-    PGINIT=@bindir@/sparcv9/initdb
-  elif grep 'sparcv8' ${PGDATA}/postmaster.opts > /dev/null; then
-    # Detected 32-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=@bindir@/sparcv8/pg_ctl
-    PGINIT=@bindir@/sparcv8/initdb
-  else
-  	echo "Couldn't detect whether the previously run version was 32 or 64-bit."
-  	echo "Running the default."
-  	PGCTL=@bindir@/pg_ctl
-  	PGINIT=@bindir@/initdb
-  fi
-fi
-
 # Exit if postgres user hasn't been created.
 # FIXME: This bit of code is old. It might be obsolete.
 if grep '^postgres:' /etc/passwd >/dev/null; then
@@ -107,11 +75,11 @@
      # 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}"
+     [ -d "${PGDATA}" -a `ls -l ${PGDATA} 2> /dev/null | wc -l` -eq 1 ] || mkdir -p "${PGDATA}"
      chown postgres "${PGDATA}"
      chmod 0700 "${PGDATA}"
      echo "Initialising PostgreSQL database..."
-     su postgres -c "${PGINIT} -D ${PGDATA} -E utf-8"
+     su postgres -c "\"${PGINIT}\" -D \"${PGDATA}\" -E utf-8"
      ;;
 
 *)


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