[arch-commits] Commit in postgresql/trunk (PKGBUILD postgresql postgresql.confd)

Dan McGee dan at archlinux.org
Mon Sep 26 20:58:47 UTC 2011


    Date: Monday, September 26, 2011 @ 16:58:47
  Author: dan
Revision: 138523

bashify init script, prepare for 9.1.1 release

Modified:
  postgresql/trunk/PKGBUILD
  postgresql/trunk/postgresql
  postgresql/trunk/postgresql.confd

------------------+
 PKGBUILD         |   13 +++++++----
 postgresql       |   62 ++++++++++++++++++++++++-----------------------------
 postgresql.confd |   17 +++++++-------
 3 files changed, 47 insertions(+), 45 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2011-09-26 20:47:05 UTC (rev 138522)
+++ PKGBUILD	2011-09-26 20:58:47 UTC (rev 138523)
@@ -3,7 +3,7 @@
 
 pkgbase=postgresql
 pkgname=('postgresql-libs' 'postgresql-docs' 'postgresql')
-pkgver=9.1.0
+pkgver=9.1.1
 _majorver=${pkgver%.*}
 pkgrel=1
 arch=('i686' 'x86_64')
@@ -118,8 +118,13 @@
     "${pkgdir}/etc/logrotate.d/postgresql"
 }
 
-md5sums=('0497b9da1d7c380c340a9a87ba5500fe'
-         '2bc5ca8d850d48fb3bb8a6d69832b6f9'
-         'bcde874133a2e07d160fb8f0b48bb842'
+md5sums=('061a9f17323117c9358ed60f33ecff78'
+         '4a6e9b63f2aa50195735f2b46aba040b'
+         '2bef962971bac882022c41a72efabb96'
          '96f82c38f3f540b53f3e5144900acf17'
          'd28e443f9f65a5712c52018b84e27137')
+sha256sums=('c794016bcf3fc1f561bc86796c6c9d050e3d8d2d55356515126e048275ae56f2'
+            'b2931d7a719e765f14811b9109310b2418d3064bfcedef699573fc25854a2201'
+            '92fe999c34824a9b8fe4b7212d58f60247e3d0514dd38807758eac64c4198190'
+            '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
+            '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e')

Modified: postgresql
===================================================================
--- postgresql	2011-09-26 20:47:05 UTC (rev 138522)
+++ postgresql	2011-09-26 20:58:47 UTC (rev 138523)
@@ -7,70 +7,66 @@
 # Default PGROOT if it wasn't defined in the conf.d file
 PGROOT=${PGROOT:-/var/lib/postgres}
 PGLOG=${PGLOG:-/var/log/postgresql.log}
-PG_CTL="/usr/bin/pg_ctl -D \"$PGROOT/data\" -l \"$PGLOG\" -s -w"
-if [ -n "$PGOPTS" ]; then
-    PG_CTL="$PG_CTL -o \"$PGOPTS\""
-fi
+PGCTL_BIN=/usr/bin/pg_ctl
+PGCTL_ARGS=(-D "$PGROOT/data" -l "$PGLOG" -s -w)
+[[ $PGOPTS ]] && PGCTL_ARGS+=(-o "$PGOPTS")
 
 postgres_init() {
     # initialization
-    if [ ! -d "$PGROOT/data" ]; then
+    if [[ ! -d "$PGROOT/data" ]]; then
         mkdir -p "$PGROOT/data" && chown -R postgres:postgres "$PGROOT"
-        su - postgres -c "/usr/bin/initdb $INITOPTS -D \"$PGROOT/data\""
+        su - postgres -c "/usr/bin/initdb $INITOPTS -D '$PGROOT/data'"
     fi
-    if [ ! -e "$PGLOG" ]; then
+    if [[ ! -e "$PGLOG" ]]; then
         touch "$PGLOG"
         chown postgres "$PGLOG"
     fi
 }
 
-case "$1" in
+do_postgres() {
+  su - postgres -c "'$PGCTL_BIN' $(printf '%q ' "${PGCTL_ARGS[@]}") $@"
+}
+
+case $1 in
   start)
     postgres_init
     stat_busy "Starting PostgreSQL"
-    su - postgres -c \
-     "$PG_CTL start"
-    if [ $? -gt 0 ]; then
-      stat_fail
-      exit 1
-    else
+    if do_postgres start; then
       add_daemon postgresql
       stat_done
+    else
+      stat_fail
+      exit 1
     fi
     ;;
   stop)
     stat_busy "Stopping PostgreSQL"
-    su - postgres -c \
-      "$PG_CTL stop -m fast"
-    if [ $? -gt 0 ]; then
-      stat_fail
-    else
+    if do_postgres stop -m fast; then
       rm_daemon postgresql
       stat_done
+    else
+      stat_fail
+      exit 1
     fi
     ;;
   reload)
     stat_busy "Reloading PostgreSQL"
-    su - postgres -c \
-      "$PG_CTL reload"
-    if [ $? -gt 0 ]; then
+    if do_postgres reload; then
+      stat_done
+    else
       stat_fail
       exit 1
-    else
-      stat_done
     fi
     ;;
   restart)
-        postgres_init
+    postgres_init
     stat_busy "Restarting PostgreSQL"
-    su - postgres -c \
-      "$PG_CTL restart -m fast"
-    if [ $? -gt 0 ]; then
-      stat_fail
-      exit 1
-    else
+    if do_postgres restart -m fast; then
       add_daemon postgresql
       stat_done
+    else
+      stat_fail
+      exit 1
     fi
     ;;
   status)
@@ -78,6 +74,6 @@
     ck_status postgresql
     ;;
   *)
-    echo "usage: $0 {start|stop|reload|restart|status}"  
+    echo "usage: $0 {start|stop|reload|restart|status}"
+    exit 1
 esac
-exit 0

Modified: postgresql.confd
===================================================================
--- postgresql.confd	2011-09-26 20:47:05 UTC (rev 138522)
+++ postgresql.confd	2011-09-26 20:58:47 UTC (rev 138523)
@@ -1,10 +1,11 @@
-#
-# Parameters to be passed to postgresql
-#
-PGROOT="/var/lib/postgres"
-# Passed to initdb if necessary
-INITOPTS="--locale $LANG"
-# Default log file location
+##
+## Parameters to be passed to postgresql
+##
+## Default data directory location
+#PGROOT="/var/lib/postgres"
+## Passed to initdb if necessary
+#INITOPTS="--locale $LANG"
+## Default log file location
 #PGLOG="/var/log/postgresql.log"
-# Additional options to pass via pg_ctl's '-o' option
+## Additional options to pass via pg_ctl's '-o' option
 #PGOPTS=""




More information about the arch-commits mailing list