File backup_pgsql.patch of Package rsnapshot

From: Guillaume Delacour <gui@iroqwa.org>
Subject: Fix path call pg_dumpall
Bug-Debian: http:/bugs.debian.org/500082
Forwarded: not-needed
Last-Update: 2013-07-31

Index: b/utils/backup_pgsql.sh
===================================================================
--- a/utils/backup_pgsql.sh
+++ b/utils/backup_pgsql.sh
@@ -9,12 +9,8 @@
 # This is a simple shell script to backup a PostgreSQL database with rsnapshot.
 #
 # The assumption is that this will be invoked from rsnapshot. Also, since it
-# will run unattended, the user that runs rsnapshot (probably root) should have
-# a .pgpass file in their home directory that contains the password for the
-# postgres user. For example:
-#
-# /root/.pgpass (chmod 0600)
-#   *:*:*:postgres:thepassword
+# will run unattended, the user that runs rsnapshot (probably root) must su
+# to the postgres user.
 #
 # This script simply needs to dump a file into the current working directory.
 # rsnapshot handles everything else.
@@ -25,7 +21,12 @@
 umask 0077
 
 # backup the database
-/usr/local/pgsql/bin/pg_dumpall -Upostgres > pg_dumpall.sql
+su -l -c 'pg_dumpall > ~/pg_dumpall.sql' postgres
 
 # make the backup readable only by root
-/bin/chmod 600 pg_dumpall.sql
+chown root.root ~postgres/pg_dumpall.sql
+chmod 600 ~postgres/pg_dumpall.sql
+
+# Move the backup to current working directory
+mv ~postgres/pg_dumpall.sql `pwd`
+
openSUSE Build Service is sponsored by