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

guengel at users.sourceforge.net guengel at users.sourceforge.net
Fri Dec 30 15:41:56 CET 2011


Revision: 16621
          http://gar.svn.sourceforge.net/gar/?rev=16621&view=rev
Author:   guengel
Date:     2011-12-30 14:41:55 +0000 (Fri, 30 Dec 2011)
Log Message:
-----------
Initialization of the database cluster is now done by invoking the start-up script's init routine. Provide the user with some more information when the database cluster has been initialized for the first time.

Added Paths:
-----------
    csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl
    csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos/files/CSWpostgresql-server.postinstall.tmpl

Removed Paths:
-------------
    csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl
    csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos/files/CSWpostgresql-server.postinstall.tmpl

Deleted: csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl	2011-12-30 14:37:41 UTC (rev 16620)
+++ csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl	2011-12-30 14:41:55 UTC (rev 16621)
@@ -1,44 +0,0 @@
-#!/bin/sh
-# vim:set ft=sh:
-#
-# $Id$
-#
-# Initialize the database cluster if it hasn't been initialized before.
-
-USERCONF=@CSWPGSQLCONFFILE_VERSIONED@
-PGCTL=@bindir@/pg_ctl- at BASE_VERSION_NODOT@
-PGINIT=@bindir@/initdb- at BASE_VERSION_NODOT@
-
-# Read in the user configuration file
-[ -s /opt/csw/etc/${USERCONF} ] && . /opt/csw/etc/${USERCONF}
-[ -s @sysconfdir@/${USERCONF} ] && . @sysconfdir@/${USERCONF}
-
-initialize_cluster() {
-	chown postgres "${PGDATA}"
-	chmod 0700 "${PGDATA}"
-	echo "Initializing PostgreSQL database..."
-	su postgres -c "\"${PGINIT}\" -D \"${PGDATA}\" -E UTF8"
-}
-
-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
-
-# FIXME: We assume that every Sol 10 user is using SMF, whereas it is possible
-# to use CSW on Sol 10 without SMF
-if [ -x /usr/sbin/svcadm ]; then
-	fmri="cswpostgresql- at BASE_VERSION_NODOT@"
-	echo "Enabling the ${fmri} service in SMF"
-	# Let things settle a little bit
-	sleep 4
-	svcadm clear "${fmri}"
-	svcadm enable "${fmri}"
-else
-	initscript="/etc/opt/csw/init.d/cswpostgresql- at BASE_VERSION_NODOT@"
-	echo "Issuing ${initscript} start"
-	"${initscript}" start
-fi
-
-exit 0

Copied: csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl (from rev 16592, csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl)
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl	                        (rev 0)
+++ csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl	2011-12-30 14:41:55 UTC (rev 16621)
@@ -0,0 +1,64 @@
+#!/bin/sh
+# vim:set ft=sh:
+#
+# $Id$
+#
+# Initialize the database cluster if it hasn't been initialized before.
+
+USERCONF=@CSWPGSQLCONFFILE_VERSIONED@
+PGCTL=@bindir@/pg_ctl- at BASE_VERSION_NODOT@
+PGINIT=@bindir@/initdb- at BASE_VERSION_NODOT@
+
+# Read in the user configuration file
+[ -s /opt/csw/etc/${USERCONF} ] && . /opt/csw/etc/${USERCONF}
+[ -s @sysconfdir@/${USERCONF} ] && . @sysconfdir@/${USERCONF}
+
+if [ ! -d "${PGDATA}" -o `ls -l ${PGDATA} 2>/dev/null | wc -l` -eq 1 ]; then
+    @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ init
+    cat <<EOF
+---
+
+The database cluster has been initialized in ${PGDATA}.
+
+Some customizations to the initialization can be made by editing the file
+
+ @sysconfdir@/${USERCONF}
+
+In order to re-initialize the database cluster, remove the directory
+
+ ${PGDATA}
+
+and call cswpostgresql- at BASE_VERSION_NODOT@ as such
+
+ @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ init
+
+PLEASE NOTE: by doing so, all data will be LOST. Thus this procedure
+             is only recommended for pristine installations.
+
+
+In order to start the PostgreSQL server you can either use
+
+ svcadm enable cswpostgresql- at BASE_VERSION_NODOT@    # Solaris 10+ only
+
+or
+
+ @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ start
+
+---
+EOF
+else
+    cat <<EOF
+---
+
+The database cluster seems to be initialized already.
+
+---
+EOF
+fi
+
+# The database server will not be started, in case the user wants to
+# do some customization to the database cluster. However, the database
+# cluster is initialized and the user simply have to start the server
+# if the defaults suits him.
+
+exit 0

Deleted: csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos/files/CSWpostgresql-server.postinstall.tmpl
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos/files/CSWpostgresql-server.postinstall.tmpl	2011-12-30 14:37:41 UTC (rev 16620)
+++ csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos/files/CSWpostgresql-server.postinstall.tmpl	2011-12-30 14:41:55 UTC (rev 16621)
@@ -1,44 +0,0 @@
-#!/bin/sh
-# vim:set ft=sh:
-#
-# $Id$
-#
-# Initialize the database cluster if it hasn't been initialized before.
-
-USERCONF=@CSWPGSQLCONFFILE_VERSIONED@
-PGCTL=@bindir@/pg_ctl- at BASE_VERSION_NODOT@
-PGINIT=@bindir@/initdb- at BASE_VERSION_NODOT@
-
-# Read in the user configuration file
-[ -s /opt/csw/etc/${USERCONF} ] && . /opt/csw/etc/${USERCONF}
-[ -s @sysconfdir@/${USERCONF} ] && . @sysconfdir@/${USERCONF}
-
-initialize_cluster() {
-	chown postgres "${PGDATA}"
-	chmod 0700 "${PGDATA}"
-	echo "Initializing PostgreSQL database..."
-	su postgres -c "\"${PGINIT}\" -D \"${PGDATA}\" -E UTF8"
-}
-
-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
-
-# FIXME: We assume that every Sol 10 user is using SMF, whereas it is possible
-# to use CSW on Sol 10 without SMF
-if [ -x /usr/sbin/svcadm ]; then
-	fmri="cswpostgresql- at BASE_VERSION_NODOT@"
-	echo "Enabling the ${fmri} service in SMF"
-	# Let things settle a little bit
-	sleep 4
-	svcadm clear "${fmri}"
-	svcadm enable "${fmri}"
-else
-	initscript="/etc/opt/csw/init.d/cswpostgresql- at BASE_VERSION_NODOT@"
-	echo "Issuing ${initscript} start"
-	"${initscript}" start
-fi
-
-exit 0

Copied: csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos/files/CSWpostgresql-server.postinstall.tmpl (from rev 16592, csw/mgar/pkg/postgresql/branches/postgresql-8.3-raos/files/CSWpostgresql-server.postinstall.tmpl)
===================================================================
--- csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos/files/CSWpostgresql-server.postinstall.tmpl	                        (rev 0)
+++ csw/mgar/pkg/postgresql/branches/postgresql-8.4-raos/files/CSWpostgresql-server.postinstall.tmpl	2011-12-30 14:41:55 UTC (rev 16621)
@@ -0,0 +1,64 @@
+#!/bin/sh
+# vim:set ft=sh:
+#
+# $Id$
+#
+# Initialize the database cluster if it hasn't been initialized before.
+
+USERCONF=@CSWPGSQLCONFFILE_VERSIONED@
+PGCTL=@bindir@/pg_ctl- at BASE_VERSION_NODOT@
+PGINIT=@bindir@/initdb- at BASE_VERSION_NODOT@
+
+# Read in the user configuration file
+[ -s /opt/csw/etc/${USERCONF} ] && . /opt/csw/etc/${USERCONF}
+[ -s @sysconfdir@/${USERCONF} ] && . @sysconfdir@/${USERCONF}
+
+if [ ! -d "${PGDATA}" -o `ls -l ${PGDATA} 2>/dev/null | wc -l` -eq 1 ]; then
+    @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ init
+    cat <<EOF
+---
+
+The database cluster has been initialized in ${PGDATA}.
+
+Some customizations to the initialization can be made by editing the file
+
+ @sysconfdir@/${USERCONF}
+
+In order to re-initialize the database cluster, remove the directory
+
+ ${PGDATA}
+
+and call cswpostgresql- at BASE_VERSION_NODOT@ as such
+
+ @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ init
+
+PLEASE NOTE: by doing so, all data will be LOST. Thus this procedure
+             is only recommended for pristine installations.
+
+
+In order to start the PostgreSQL server you can either use
+
+ svcadm enable cswpostgresql- at BASE_VERSION_NODOT@    # Solaris 10+ only
+
+or
+
+ @sysconfdir@/init.d/cswpostgresql- at BASE_VERSION_NODOT@ start
+
+---
+EOF
+else
+    cat <<EOF
+---
+
+The database cluster seems to be initialized already.
+
+---
+EOF
+fi
+
+# The database server will not be started, in case the user wants to
+# do some customization to the database cluster. However, the database
+# cluster is initialized and the user simply have to start the server
+# if the defaults suits him.
+
+exit 0

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