Your message dated Fri, 09 Mar 2012 13:02:12 +0000
with message-id <[email protected]>
and subject line Bug#637743: fixed in backup-manager 0.7.10.1-1
has caused the Debian Bug report #637743,
regarding backup-manager: Please add a "postgresql" backup method
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
637743: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637743
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: backup-manager
Version: 0.7.9-3
Severity: wishlist
Tags: upstream patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Attached you will find a patch (backup-method-postgresql.diff) to add a 
"postgresql" method
to backup manager. AFAIK PostgreSQL is the default DBMS installed by Debian 
Installer, thus
supplying such a backup method would be useful.

A second, optional, patch (rename-mysql-databases.diff) renames the dump 
created by mysql 
backup method for individual database(s) so that it contains the DBMS 
identifier, just 
like the postgres method supplied here does. It is not essential, but I thought 
it makes
sense, especially in view of possible future addition of other DBMS dumping 
methods.

The code uses the pg_dump and pg_dumpall utilities of postgresql to provide the 
ability to
dump specific database(s) or the entire postgres cluster. A new section was 
added to the
configuration template. Configuration directives were chosen in a way to be as 
much as
possible compatible with the existing ones of the MySQL backup method.

I have tested it with my (very basic at the moment) postgres setup and it seems 
to work ok:

- -- both the entire cluster and individual databases dumps are generated 
   (note: I have used only the local unix sockets method to connect in my tests)

- -- no errors from pd_dump, pg_dumpall appear in logs

I have also verified that the package builds if the patches are appended to the 
existing
debian/patches/series in the order given here (ie all patches succeed).

I release the code with the same license as backup-manager does.

regards
George Zarkadas

- -- System Information:
Debian Release: 6.0.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 
'stable'), (450, 'testing-proposed-updates'), (450, 'testing'), (400, 
'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=el_GR.utf8, LC_CTYPE=el_GR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages backup-manager depends on:
ii  debconf [debconf-2.0]        1.5.36.1    Debian configuration management sy
ii  findutils                    4.4.2-1+b1  utilities for finding files--find,
ii  ucf                          3.0025+nmu1 Update Configuration File: preserv

backup-manager recommends no packages.

Versions of packages backup-manager suggests:
ii  anacron               2.3-14             cron-like program that doesn't go 
ii  backup-manager-doc    0.7.9-3            documentation package for Backup M
ii  dar                   2.3.10-1+b1        Disk ARchive: Backup directory tre
ii  dvd+rw-tools          7.1-6              DVD+-RW/R tools
ii  genisoimage           9:1.1.11-1         Creates ISO-9660 CD-ROM filesystem
ii  gettext-base          0.18.1.1-3         GNU Internationalization utilities
ii  libfile-slurp-perl    9999.13-1          single call read & write file rout
pn  libnet-amazon-s3-perl <none>             (no description available)
ii  openssh-client        1:5.5p1-6+squeeze1 secure shell (SSH) client, for sec
ii  perl                  5.10.1-17squeeze2  Larry Wall's Practical Extraction 
ii  wodim                 9:1.1.11-1         command line CD/DVD writing tool
ii  zip                   3.0-3              Archiver for .zip files

- -- debconf information excluded


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJORxrpAAoJEJWXIVmJ5BwW6XAH/1Qaw4agOvpycstJFcxB0ysh
Rco1a5AoAaCboXv2+eumssg72XxSTfJEoVp+Ub6dgti6jtXYrVd9y8VSbrnloiuC
KNpj8s5UuZ0m0UXI4RUbNQkojp9PbUlM8iWM6f7w+53jXMo9g11Er89/xIshtkyd
3o+WJfpyReKCVXLJFVfQj3slpGLGwuTA22h5vHsHcpUGGrzfaKFu/81RhILPgwxa
0gRCtFCckRp4VCjDW0E5gOFb+tPaZb60UEi786sM5rp8rd872CJkWwEnp5mBw5fL
GKc5VQr97/lBC1hECBS5j93DRnWhQtthVghfy/6d7Iy/XNnRSTohjlUj92bMu6g=
=n41A
-----END PGP SIGNATURE-----
--- a/backup-manager.conf.tpl
+++ b/backup-manager.conf.tpl
@@ -72,6 +72,7 @@
 # - tarball
 # - tarball-incremental
 # - mysql
+# - postgresql
 # - svn
 # - pipe
 # - none
@@ -225,6 +226,73 @@
 export BM_MYSQL_EXTRA_OPTIONS=""
 
 ##############################################################
+# Backup method: PostgreSQL
+#############################################################
+
+# This method is dedicated to PostgreSQL databases.
+# You should not use the tarball method for backing up database
+# directories or you may have corrupted archives (unless, -and
+# this is specific for PostgreSQL- you also continuously backup
+# the Write Ahead Log; see the PostgreSQL documentation for 
+# details).
+# Enter here the list of databases to backup.
+# Wildcard: __ALL__ (will dump all the databases in one archive)
+export BM_POSTGRESQL_DATABASES="__ALL__"
+
+# The PostgreSQL user who is allowed to read every database of those
+# filled in BM_POSTGRESQL_DATABASES.
+export BM_POSTGRESQL_ADMINLOGIN=""
+
+# The above user's password.
+# WARNING! Be sure to protect this file with strict permissions.
+export BM_POSTGRESQL_ADMINPASS=""
+
+# The host where the database is.
+# Leave it empty for local access through unix sockets (the default).
+# Set to "localhost" for local access through the loopback interface.
+export BM_POSTGRESQL_HOST=""
+
+# The port where PostgreSQL listens to on the host.
+export BM_POSTGRESQL_PORT="5433"
+
+# Select the format of the output. It can be one of the following:
+# -- plain  : Plain-text SQL script file (the default).
+# -- custom : Custom-format archive suitable for input into pg_restore.
+# -- tar    : Tar-format archive suitable for input into pg_restore.
+# 
+# If you want to be able to transfer the database(s) to database platforms
+# other than PostgreSQL, use the plain format. Else it is perhaps better
+# to use the custom format, which offers the most flexibility as well as
+# builtin compression.
+# Note that the dump of __ALL__ target is always in plain format, since
+# pg_dumpall does not accept any option to set it.
+# See 'man pg_dump' and 'man pg_dumpall' for more information.
+export BM_POSTGRESQL_DUMPFORMAT="plain"
+
+# Which compression format to use? Relevant only if output format is 'plain'.
+# Available: all that are available for tarball method (gzip, bzip2, etc).
+export BM_POSTGRESQL_FILETYPE="bzip2"
+
+# Extra options to prepend to the database dump generation. 
+# Take care to what you do; this will be silently added to the 
+# command line.
+# Note that the basic options (hostname, port, etc) come after this on
+# the dump program's command line; thus they cannot be overriden.
+#
+# Example: add commands to drop objects before creating them (valid for
+# the "plain" output format).
+#
+#     export BM_PGDUMP_EXTRA_OPTIONS="--clean"
+
+# Extra options when dumping individual database(s).
+# Passed to pg_dump. See the man page for reference.
+export BM_PGDUMP_EXTRA_OPTIONS=""
+
+# Extra options when dumping the entire database cluster.
+# Passed to pg_dumpall. See the man page for reference.
+export BM_PGDUMPALL_EXTRA_OPTIONS=""
+
+##############################################################
 # Backup method: svn
 #############################################################
 
--- a/lib/actions.sh
+++ b/lib/actions.sh
@@ -31,6 +31,9 @@
         mysql)
             backup_method_mysql "$method"
         ;;
+        postgresql)
+            backup_method_postgresql "$method"
+        ;;
         tarball|tarball-incremental)
             backup_method_tarball "$method"
         ;;
--- a/lib/backup-methods.sh
+++ b/lib/backup-methods.sh
@@ -930,6 +930,74 @@
     fi
 }
 
+function backup_method_postgresql()
+{
+    method="$1"
+    pgpass_file="$HOME/.pgpass"
+
+    debug "backup_method_postgresql ($method)"
+
+    info "Using method \"\$method\"."
+    if [[ -x $pgdump ]] && [[ -x $pgdumpall ]]; then
+        :
+    else
+        error "The \"postgresql\" method is chosen, but \$pgdump and/or 
\$pgdumpall are not found."
+    fi
+
+    # if a PostgreSQL password file exists, the password must be inside
+    if [[ -f $pgpass_file ]]; then
+        info "Using existing PostgreSQL password file: \$pgpass_file"
+        BM_SHOULD_PURGE_PGPASS="false"
+    # we create a default one, just with the password
+    else
+        warning "Creating a default PostgreSQL password file: \$pgpass_file"
+        : > $pgpass_file
+        chmod 600 $pgpass_file
+        echo 
"$BM_POSTGRESQL_HOST:$BM_POSTGRESQL_PORT:*:$BM_POSTGRESQL_ADMINLOGIN:$BM_POSTGRESQL_ADMINPASS"
 >> $pgpass_file
+        BM_SHOULD_PURGE_PGPASS="true"
+    fi
+
+    # Account for empty host when unix sockets are used to connect
+    # to a local postgres server.
+
+    if [[ "X$BM_POSTGRESQL_HOST" = "X" ]]; then
+        BM_POSTGRESQL_HOSTFLAGS=""
+    else
+        BM_POSTGRESQL_HOSTFLAGS="-h$BM_POSTGRESQL_HOST"
+    fi
+
+    # We omit the binary from base_command, because backing up all databases
+    # requires a different binary than backing up specific database(s).
+    # It will be added later, during scanning of databases-to-backup phase.
+
+    base_command="--no-password -U$BM_POSTGRESQL_ADMINLOGIN 
$BM_POSTGRESQL_HOSTFLAGS -p$BM_POSTGRESQL_PORT"
+
+    for database in $BM_POSTGRESQL_DATABASES
+    do
+        if [[ "$database" = "__ALL__" ]]; then
+            
file_to_create="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-all-postgresql-databases.$TODAY.sql"
+            command="$pgdumpall $BM_PGDUMPALL_EXTRA_OPTIONS $base_command"
+            compress=$BM_POSTGRESQL_FILETYPE
+        else
+            
file_to_create="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-postgresql-${database}.$TODAY.sql"
+            if [[ "$BM_POSTGRESQL_DUMPFORMAT" = "plain" ]]; then
+                command="$pgdump $BM_PGDUMP_EXTRA_OPTIONS $base_command 
$database"
+                compress=$BM_POSTGRESQL_FILETYPE
+            else
+                command="$pgdump $BM_PGDUMP_EXTRA_OPTIONS 
-F$BM_POSTGRESQL_DUMPFORMAT $base_command $database"
+                compress="none"   
+            fi
+        fi
+        __create_file_with_meta_command
+    done 
+
+    # purge the pgpass file, if created by Backup Manager
+    if [[ "$BM_SHOULD_PURGE_PGPASS" == "true" ]]; then
+        info "Removing default PostgreSQL password file: \$pgpass_file"
+        rm -f $pgpass_file
+    fi
+}
+
 function backup_method_svn()
 {
     method="$1"
--- a/lib/externals.sh
+++ b/lib/externals.sh
@@ -14,6 +14,8 @@
 md5sum=$(which md5sum 2> /dev/null) || true
 bc=$(which bc 2> /dev/null) || true
 mysqldump=$(which mysqldump 2> /dev/null) || true
+pgdump=$(which pg_dump 2> /dev/null) || true
+pgdumpall=$(which pg_dumpall 2> /dev/null) || true
 svnadmin=$(which svnadmin 2> /dev/null) || true
 logger=$(which logger 2> /dev/null) || true
 nice_bin=$(which nice 2> /dev/null) || true
--- a/lib/sanitize.sh
+++ b/lib/sanitize.sh
@@ -231,6 +231,13 @@
     confkey_require "BM_MYSQL_HOST" "localhost"
     confkey_require "BM_MYSQL_PORT" "3306"
     confkey_require "BM_MYSQL_FILETYPE" "tar.gz"
+fi
+
+if [[ "$BM_ARCHIVE_METHOD" = "postgresql" ]]; then
+    confkey_require "BM_POSTGRESQL_ADMINLOGIN" "postgres"
+    confkey_require "BM_POSTGRESQL_PORT" "5433"
+    confkey_require "BM_POSTGRESQL_DUMPFORMAT" "plain"
+    confkey_require "BM_POSTGRESQL_FILETYPE" "gzip"
 fi
 
 # Burning system
--- a/man/backup-manager.8
+++ b/man/backup-manager.8
@@ -10,8 +10,9 @@
 for those who don't want an obfuscated tool for making tarballs. 
 .P
 There are different methods for building archives: tarballs, incremental 
-tarballs, mysql dumps, svn dump. You can also write your own method with a 
-generic method that will execute a command and will archive its output.
+tarballs, mysql dumps, postgresql dumps, svn dump. You can also write 
+your own method with a generic method that will execute a command and 
+will archive its output.
 .P
 Every times you run Backup Manager, you can upload archives thanks to a couple
 of upload methods: through FTP, SSH or even with RSYNC.
--- a/lib/backup-methods.sh
+++ b/lib/backup-methods.sh
@@ -917,7 +917,7 @@
             
file_to_create="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-all-mysql-databases.$TODAY.sql"
             command="$base_command --all-databases"
         else
-            
file_to_create="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-${database}.$TODAY.sql"
+            
file_to_create="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-mysql-${database}.$TODAY.sql"
             command="$base_command $database"
         fi
         __create_file_with_meta_command

--- End Message ---
--- Begin Message ---
Source: backup-manager
Source-Version: 0.7.10.1-1

We believe that the bug you reported is fixed in the latest version of
backup-manager, which is due to be installed in the Debian FTP archive:

backup-manager-doc_0.7.10.1-1_all.deb
  to main/b/backup-manager/backup-manager-doc_0.7.10.1-1_all.deb
backup-manager_0.7.10.1-1.debian.tar.gz
  to main/b/backup-manager/backup-manager_0.7.10.1-1.debian.tar.gz
backup-manager_0.7.10.1-1.dsc
  to main/b/backup-manager/backup-manager_0.7.10.1-1.dsc
backup-manager_0.7.10.1-1_all.deb
  to main/b/backup-manager/backup-manager_0.7.10.1-1_all.deb
backup-manager_0.7.10.1.orig.tar.gz
  to main/b/backup-manager/backup-manager_0.7.10.1.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Sven Joachim <[email protected]> (supplier of updated backup-manager package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 07 Mar 2012 19:08:15 +0100
Source: backup-manager
Binary: backup-manager backup-manager-doc
Architecture: source all
Version: 0.7.10.1-1
Distribution: unstable
Urgency: low
Maintainer: Sven Joachim <[email protected]>
Changed-By: Sven Joachim <[email protected]>
Description: 
 backup-manager - command-line backup tool
 backup-manager-doc - documentation package for Backup Manager
Closes: 491199 567553 602633 608237 610413 637743 638803 638920 655985 659162
Changes: 
 backup-manager (0.7.10.1-1) unstable; urgency=low
 .
   [ Sven Joachim ]
   * New upstream release (Closes: #655985).
     - Adds a new "postgresql" backup method (Closes: #637743).
   * Remove the fragile translation-updates.diff patch.  Instead, backup
     the upstream po files before the build and restore them in the clean
     target (Closes: #602633).
   * Depend on perl (via ${perl:Depends}), rather than than suggesting it,
     since perl is required by backup-manager-purge (LP: #941919).
   * Drop the debian-perl-location.diff patch, setting PERL5DIR in
     debian/rules instead.
   * Refresh the remaining Debian patches.
   * Fill out the same "Language:" header in debian/po/*.po.
   * Drop findutils dependency, even the version in Etch is new enough.
   * Upgrade Standards-Version to 3.9.3, no changes needed.
   * Update lintian override for Lintian 2.5.
   * Update debian/watch to find the 0.7.10.1 release tarball.
   * Add build-indep and (empty) build-arch targets to debian/rules.
   * Update Vcs-* fields in debian/control, switching to collab-maint.
   * Fix a few typos in the debconf templates, thanks to Daniele Forsi
     for the report.
   * Update README.Debian, the Amazon S3 upload method not longer needs
     libfile-slurp-perl (see #491199).
   * Demote the priority of the repo_user/repo_group debconf templates to
     medium.
   * Update debian/copyright.
 .
   [ Georgios M. Zarkadas ]
   * Add Greek debconf translation.
   * Allow absolute paths in BM_TARBALL_BLACKLIST even when backing up
     the root (/) directory (Closes: #608237).
   * Fix missed archive uploads when backups are crossing the day
     limit (Closes: # 638803).
   * Provide a configuration option to record all uploaded archives in
     a single text database file (Closes: #638920).
   * Fix upstream makefile to make the build/clean process of gettext (po)
     files idempotent and bring sanity back to the package's build process.
   * Fix a security issue in pgsql backup method regarding the .pgpass
     file handling.
   * Add support for local unix sockets connections to the pgsql backup method.
   * Add existence check for pg_dumpall to the pgsql backup method.
   * Use the same naming convention for database methods generated archives.
   * Add myself to Uploaders.
   * Add cron script to remove old entries from uploaded archives database.
   * Update control file to reflect upstream fix of Amazon S3 uploading
     method's dependencies (Closes: #491199).
   * Fix missed warnings when BM_LOGGER* variables are undefined or wrongly
     configured (Closes: #567553).
   * Change configurator to dynamically update BM_TARBALL_BLACKLIST when
     user selections change during configuration (Closes: #610413).
   * Add backtracking support to the configurator.
 .
   [ Sven Joachim, Georgios M. Zarkadas ]
   * Switch source format to 3.0 (quilt).
     - Drop debian/README.source.
   * Change debian/rules to use the generic 'dh$@' rule plus overrides.
 .
   [ Joe Dalton ]
   * Add Danish debconf translation (Closes: #659162).
Checksums-Sha1: 
 52102a178a9a5c99d031b2be7f1a756f7c441d90 2193 backup-manager_0.7.10.1-1.dsc
 a08768acff444275c3b33e35a808280106060641 150963 
backup-manager_0.7.10.1.orig.tar.gz
 e54e17f9a6ff9a78bb983f6d9f1653f1f9ac19b8 75326 
backup-manager_0.7.10.1-1.debian.tar.gz
 b959bc66c6b042ce36240bc3f9a2dc0e367fca3f 159432 
backup-manager_0.7.10.1-1_all.deb
 db61174d7f10f7a06d7e5c90c6e29772486523b1 234504 
backup-manager-doc_0.7.10.1-1_all.deb
Checksums-Sha256: 
 bcf6a886a56bf649734293a6729642b762cbfa4d5cebb3ab56892d2a34561995 2193 
backup-manager_0.7.10.1-1.dsc
 16994520d3fded41e166d17c946405dd192acf960603044aa6c915465e78d41f 150963 
backup-manager_0.7.10.1.orig.tar.gz
 46b68be7b01a990c5e9a869d7fcf7d2f7ae82d5dd614210d66f5342db45faaac 75326 
backup-manager_0.7.10.1-1.debian.tar.gz
 b701261e84675312ba11b9a6204698b42be333c4ba31b41cd50728bf64a60621 159432 
backup-manager_0.7.10.1-1_all.deb
 f09760ba85ad0716f4ca37e20c630a76db5912f78779a45d673a80de8dbaf323 234504 
backup-manager-doc_0.7.10.1-1_all.deb
Files: 
 e1e1cbd3b3ed95849724296c81bbc390 2193 admin optional 
backup-manager_0.7.10.1-1.dsc
 b7f1e6ecfb6c45116e9aef2de92ffb12 150963 admin optional 
backup-manager_0.7.10.1.orig.tar.gz
 6c36718a802ebea270f79a162a9dab10 75326 admin optional 
backup-manager_0.7.10.1-1.debian.tar.gz
 626a3bd130e39ac359c0d98240026396 159432 admin optional 
backup-manager_0.7.10.1-1_all.deb
 6efe622a55bb99d2701966eb2e23d5b8 234504 doc optional 
backup-manager-doc_0.7.10.1-1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJPWf2oAAoJEMcZdpmymyMqGWEQAJ+XQDnWcjnvTlPA7U1TQpOz
L4H45lB5N0w9pkxORnxw6qG9KU1FZFtdtiFUNqEsNFYdN4h6FI/NL9Un5xMh6Zhb
ApMKftW5BVdLaXqW0Wr+y0+ejeeZDmr/3DACGqQgKFEelna6It2bp4UeNQEqSRdZ
EH2LldQNCw5nhsJt9WDoXofyjTPA3jiD9BpYal9PXoRKWuFRTvWBB1GTm5mi5LCB
M92IhvELpd1TEG3eC4OHLI1gaQsHe9n6G2sPBSU7VGbSkCUBfjXBG4iAUPAcQO+G
eFAt0Yfml/6o76Q762OJN27/0c7LmwS3WwzhDGYbpL1nWIBiscbK2Aw2CzrtY58r
IOw0nLOUolj04PmfF9Mgs39EVrxxr4teix3hyBuxnuga2Ftih/NH3hT8Zb9Y+TA4
umeSKu0DRCNuRAMfaGS+iKaqSnpTFlp4P1hynNkPcVptY6fhqfpGuOLHZrkr9kmF
IK8Tue561mFQNUqx/AqOiNMs46xlDy7kci/zrLIUhjKnZ7QMEtiNTqqewz6YUZfD
jZWHioJIFSHTLCuiILDdFGrW01o9a/Rt/kNJmn6xCJfQ3j1iuKEwVWSWKOy1JQo/
sUL5SJzuPKl3WKYvy7DOFKd5JIOVMLubtNpeg5LMoEBs/Tobmuj0hbjOAtAkwzvW
WOjEZGO/1zC7FbWL+ZlE
=OHCS
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to