[csw-devel] SF.net SVN: gar:[11034] csw/mgar/pkg/postgresql/branches/optcsw
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Wed Sep 22 09:05:45 CEST 2010
Revision: 11034
http://gar.svn.sourceforge.net/gar/?rev=11034&view=rev
Author: wahwah
Date: 2010-09-22 07:05:45 +0000 (Wed, 22 Sep 2010)
Log Message:
-----------
postgres: Committing working changes; next step will be to use GAR inbuilt variable substitution.
Modified Paths:
--------------
csw/mgar/pkg/postgresql/branches/optcsw/Makefile
csw/mgar/pkg/postgresql/branches/optcsw/files/CSWpostgresql-84.postinstall
csw/mgar/pkg/postgresql/branches/optcsw/files/README-CSW.txt
csw/mgar/pkg/postgresql/branches/optcsw/files/cswpostgres.tmpl
Modified: csw/mgar/pkg/postgresql/branches/optcsw/Makefile
===================================================================
--- csw/mgar/pkg/postgresql/branches/optcsw/Makefile 2010-09-21 22:11:50 UTC (rev 11033)
+++ csw/mgar/pkg/postgresql/branches/optcsw/Makefile 2010-09-22 07:05:45 UTC (rev 11034)
@@ -40,7 +40,7 @@
# 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)
datadir = $(prefix)/share/$(GARNAME)/$(BASE_VERSION)
@@ -62,8 +62,7 @@
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)
@@ -160,12 +159,13 @@
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-$(BASE_VERSION_G) += $(libdir).*lib(pq|pgtypes|ecpg)\.so.*
+PKGFILES_CSWlibpq-$(BASE_VERSION_G) += $(libdir).*libpq\.so.*
# 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
@@ -215,12 +215,24 @@
$(INSTALL_ENV) gmake -C $(WORKSRC)/contrib DESTDIR=$(DESTDIR) install
@$(MAKECOOKIE)
+post-extract:
+ gsed -ie 's+ at sysconfdir@+$(sysconfdir)+g' \
+ $(WORKDIR)/CSWpostgresql-$(BASE_VERSION_G).postinstall
+ gsed -ie 's+ at PGDATA@+$(PGDATA)+g' \
+ $(WORKDIR)/CSWpostgresql-$(BASE_VERSION_G).postinstall
+ gsed -ie 's+ at bindir@+$(bindir)+g' \
+ $(WORKDIR)/CSWpostgresql-$(BASE_VERSION_G).postinstall
+ gsed -ie 's+ at VERSION_NODOT@+$(VERSION_NODOT)+g' \
+ $(WORKDIR)/CSWpostgresql-$(BASE_VERSION_G).postinstall
+ @$(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' \
+ -e 's+ at VERSION_NODOT@+$(VERSION_NODOT)+g' \
< $(FILEDIR)/cswpostgres.tmpl \
> $(WORKDIR)/$(initscript_base_name)
ginstall \
Modified: csw/mgar/pkg/postgresql/branches/optcsw/files/CSWpostgresql-84.postinstall
===================================================================
--- csw/mgar/pkg/postgresql/branches/optcsw/files/CSWpostgresql-84.postinstall 2010-09-21 22:11:50 UTC (rev 11033)
+++ csw/mgar/pkg/postgresql/branches/optcsw/files/CSWpostgresql-84.postinstall 2010-09-22 07:05:45 UTC (rev 11034)
@@ -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
Modified: csw/mgar/pkg/postgresql/branches/optcsw/files/README-CSW.txt
===================================================================
--- csw/mgar/pkg/postgresql/branches/optcsw/files/README-CSW.txt 2010-09-21 22:11:50 UTC (rev 11033)
+++ csw/mgar/pkg/postgresql/branches/optcsw/files/README-CSW.txt 2010-09-22 07:05:45 UTC (rev 11034)
@@ -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/optcsw/files/cswpostgres.tmpl
===================================================================
--- csw/mgar/pkg/postgresql/branches/optcsw/files/cswpostgres.tmpl 2010-09-21 22:11:50 UTC (rev 11033)
+++ csw/mgar/pkg/postgresql/branches/optcsw/files/cswpostgres.tmpl 2010-09-22 07:05:45 UTC (rev 11034)
@@ -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