packages (DEVEL): postgresql/postgresql-ac_version.patch, postgresql/postgr...

radek radek at pld-linux.org
Wed Jul 1 18:59:28 CEST 2009


Author: radek                        Date: Wed Jul  1 16:59:28 2009 GMT
Module: packages                      Tag: DEVEL
---- Log message:
- merge HEAD versions to DEVEL;  seem newer

---- Files affected:
packages/postgresql:
   postgresql-ac_version.patch (1.3.2.1 -> 1.3.2.2) , postgresql.init (1.66 -> 1.66.2.1) , postgresql.sysconfig (1.17 -> 1.17.2.1) 

---- Diffs:

================================================================
Index: packages/postgresql/postgresql-ac_version.patch
diff -u packages/postgresql/postgresql-ac_version.patch:1.3.2.1 packages/postgresql/postgresql-ac_version.patch:1.3.2.2
--- packages/postgresql/postgresql-ac_version.patch:1.3.2.1	Thu Apr 16 10:40:27 2009
+++ packages/postgresql/postgresql-ac_version.patch	Wed Jul  1 18:59:22 2009
@@ -1,13 +1,17 @@
---- postgresql-8.4beta1.orig/configure.in	2009-04-10 01:20:10.000000000 +0100
-+++ postgresql-8.4beta1/configure.in	2009-04-16 09:35:30.000000000 +0100
-@@ -19,10 +19,6 @@
+--- postgresql-8.3RC1/configure.in.orig	2008-01-07 22:23:47.888774598 +0000
++++ postgresql-8.3RC1/configure.in	2008-01-07 22:23:50.888568429 +0000
+@@ -19,10 +19,10 @@
  
- AC_INIT([PostgreSQL], [8.4beta1], [pgsql-bugs at postgresql.org])
+ AC_INIT([PostgreSQL], [8.3RC1], [pgsql-bugs at postgresql.org])
  
--m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.61], [], [m4_fatal([Autoconf version 2.61 is required.
+-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.59], [], [m4_fatal([Autoconf version 2.59 is required.
 -Untested combinations of 'autoconf' and PostgreSQL versions are not
 -recommended.  You can remove the check from 'configure.in' but it is then
 -your responsibility whether the result works or not.])])
- AC_COPYRIGHT([Copyright (c) 1996-2009, PostgreSQL Global Development Group])
++dnl m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.59], [], [m4_fatal([Autoconf version 2.59 is required.
++dnl Untested combinations of 'autoconf' and PostgreSQL versions are not
++dnl recommended.  You can remove the check from 'configure.in' but it is then
++dnl your responsibility whether the result works or not.])])
+ AC_COPYRIGHT([Copyright (c) 1996-2008, PostgreSQL Global Development Group])
  AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
  AC_CONFIG_AUX_DIR(config)

================================================================
Index: packages/postgresql/postgresql.init
diff -u packages/postgresql/postgresql.init:1.66 packages/postgresql/postgresql.init:1.66.2.1
--- packages/postgresql/postgresql.init:1.66	Sat Jul 23 20:09:26 2005
+++ packages/postgresql/postgresql.init	Wed Jul  1 18:59:22 2009
@@ -18,6 +18,8 @@
 # Get network config
 . /etc/sysconfig/network
 
+PG_INIT_LOCALE=C
+
 # Get service config
 if [ -f /etc/sysconfig/postgresql ]; then
 	. /etc/sysconfig/postgresql
@@ -71,15 +73,15 @@
 pgstatus() {
 	PG_STATUS="unknown"
 	PG_PID="unknown"
-	output=`TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $1 status"`
-	status=`echo $?`
+	output=$(LC_ALL=C TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $1 status")
+	status=$?
 
 	if [ $status -eq 1 ]; then
 		PG_STATUS="not running"
 	elif [ $status -eq 0 ]; then
 		PG_STATUS="running"
         # or maybe grab it from postmaster.pid file?
-		PG_PID=`echo "$output" | sed 's/^pg_ctl:.*PID: \([0-9]\+\).*/\1/' | head -1`
+		PG_PID=$(echo "$output" | awk '/PID: / { match($0, "PID: [0-9]+"); print substr($0,RSTART+5,RLENGTH-5) }')
 	fi
 }
 
@@ -90,8 +92,9 @@
 # $1 - db cluster
 #
 pgstart() {
+	is_no "$RC_LOGGING" && fork=--fork
 	msg_starting "PostgreSQL $1"
-	daemon --user postgres /usr/bin/pg_ctl -s -w -D $1 start
+	daemon $fork --user postgres /usr/bin/pg_ctl -s -w -D $1 start
 }
 
 #
@@ -114,18 +117,13 @@
 # End of useful functions.
 #
 
-
-# See how we were called.
-# Every action is performed for all given (all configured by default)
-# db clusters.
-case "$action" in
-  start)
+start() {
 	for pgdir in $DB_CLUSTERS; do
 		pgstatus "$pgdir"
 		if [ "$PG_STATUS" = "running" ]; then
 			# pg_ctl status can misinform us about postgresql status
 			# so let's check if postmaster is really alive
-			if ps ax | grep -v grep | grep -q "$PG_PID"; then
+			if ps -p "$PG_PID" >/dev/null; then
 				msg_already_running "PostgreSQL $pgdir"
 			else
 				# pg_ctl has misinformed us about postgresql status;
@@ -139,8 +137,9 @@
 		fi
 	done
 	pgsubsys
-	;;
-  stop)
+}
+
+stop() {
 	for pgdir in $DB_CLUSTERS; do
 		pgstatus "$pgdir"
 		if [ "$PG_STATUS" = "not running" ]; then
@@ -148,8 +147,8 @@
 		else
 			msg_stopping "PostgreSQL $pgdir"
 			busy
-				# is postgresql really alive?
-			if ps ax | grep -v grep | grep -q "$PG_PID"; then
+			# is postgresql really alive?
+			if ps -p "$PG_PID" >/dev/null; then
 				TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -w -D $pgdir stop -m fast 2>&1 >/dev/null"
 				pgstatus "$pgdir"
 				if [ "$PG_STATUS" != "not running" ]; then
@@ -166,33 +165,66 @@
 		fi
 	done
 	pgsubsys
+}
+
+RETVAL=0
+# See how we were called.
+# Every action is performed for all given (all configured by default)
+# db clusters.
+case "$action" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   status)
 	for pgdir in $DB_CLUSTERS; do
-	TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $pgdir status"
-		done
+		pgstatus "$pgdir"
+		if [ "$PG_STATUS" = "running" ]; then
+			show "PostgreSQL cluster %s, PID %s" "$pgdir" "$PG_PID"
+			progress "$PG_STATUS"
+		else
+			show "PostgreSQL cluster %s" "$pgdir"
+			progress "$PG_STATUS" "$CFAIL"
+		fi
+		echo
+	done
 	;;
   restart)
-	$0 stop "$DB_CLUSTERS"
-	$0 start "$DB_CLUSTERS"
+	stop
+	start
 	;;
-  reload|force-reload)
+  reload|force-reload|try-restart)
+	if [ "$action" = "reload" ]; then
+		# "reload" must not restart service - so let it reload only what's possible
+		pgctlact="reload"
+	else
+		pgctlact="restart"
+	fi
 	for pgdir in $DB_CLUSTERS; do
 		pgstatus "$pgdir"
 		if [ "$PG_STATUS" = "not running" ]; then
 			msg_not_running "PostgreSQL $pgdir"
+			if [ "$action" != "try-restart" ]; then
+				RETVAL=7
+			fi
 		else
 			msg_reloading "PostgreSQL $pgdir"
 			busy
 			# is postgresql really alive?
-			if ps ax | grep -v grep | grep -q "$PG_PID"; then
-				TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $pgdir restart 2>&1 >/dev/null"
+			if ps -p "$PG_PID" >/dev/null; then
+				TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $pgdir $pgctlact 2>&1 >/dev/null"
 					pgstatus "$pgdir"
 				if [ "$PG_STATUS" = "running" ]; then
 					ok
 				else
 					fail
 				fi
+			elif [ "$action" != "try-restart" ]; then
+				# postgresql died and pg_ctl has misinformed us about
+				# the status - i.e. service is actually not running
+				RETVAL=7
 			else
 				# postgresql died and pg_ctl has misinformed us about
 				# the status; remove pid file and start it again
@@ -216,7 +248,7 @@
 			mkdir -p $pgdir
 			chmod 700 $pgdir
 			chown postgres:postgres $pgdir
-			TMPDIR=/tmp su postgres -s /bin/sh -c "initdb -E UNICODE -D $pgdir"
+			LC_ALL=$PG_INIT_LOCALE TMPDIR=/tmp su postgres -s /bin/sh -c "initdb -E UNICODE -D $pgdir"
 		fi
 	done
 	echo $(nls "REMEMBER to setup password for user \"postgres\"")'!'
@@ -226,4 +258,4 @@
 	exit 3
 esac
 
-exit 0
+exit $RETVAL

================================================================
Index: packages/postgresql/postgresql.sysconfig
diff -u packages/postgresql/postgresql.sysconfig:1.17 packages/postgresql/postgresql.sysconfig:1.17.2.1
--- packages/postgresql/postgresql.sysconfig:1.17	Thu Jan  9 18:52:24 2003
+++ packages/postgresql/postgresql.sysconfig	Wed Jul  1 18:59:22 2009
@@ -2,12 +2,15 @@
 
 #
 # Edit postgresql.conf file in database cluster directory to configure
-# PostgreSQL. When you want to start more then one PostgreSQL instance,
-# than you should change TCP/IP port, at least.
+# PostgreSQL. If you want to start more than one PostgreSQL instance,
+# you should change TCP/IP port, at least.
 #
 
+# locale used at service postgresql init
+# PG_INIT_LOCALE=C
+
 # standard setting
-# PG_DB_CLUSTERS="/var/lib/pgsql"
+PG_DB_CLUSTERS="/var/lib/pgsql"
 
 # predictable usage
 # PG_DB_CLUSTERS="/var/lib/pgsql/01 /var/lib/pgsql/02"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/postgresql/postgresql-ac_version.patch?r1=1.3.2.1&r2=1.3.2.2&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/postgresql/postgresql.init?r1=1.66&r2=1.66.2.1&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/postgresql/postgresql.sysconfig?r1=1.17&r2=1.17.2.1&f=u



More information about the pld-cvs-commit mailing list