Package: automysqlbackup
Severity: wishlist
Tags: patch

Here's a patch adding support for xz compression to the current
gzip/bzip2 alternatives.

A similar patch was submitted, and subsequently rejected by upstream,
several years ago[1].  Nonetheless, xz has gained traction since then,
and its performance can be quite impressive in some situations.


[1] http://sourceforge.net/p/automysqlbackup/patches/21/


-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (x86_64)
Foreign Architectures: amd64

Kernel: Linux 3.16.0-4-amd64 (SMP w/3 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
>From 47fc261864e6949d96f56f862260e135e2ca4276 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= <fbri...@fbriere.net>
Date: Wed, 29 Apr 2015 19:03:58 -0400
Subject: [PATCH] Add support for xz compression

---
 automysqlbackup              | 42 +++++++++++++++++++++++++++---------------
 debian/control               |  1 +
 debian/defaults              |  2 +-
 debian/man/automysqlbackup.8 |  2 +-
 4 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/automysqlbackup b/automysqlbackup
index ddbea01..6b1f410 100755
--- a/automysqlbackup
+++ b/automysqlbackup
@@ -76,7 +76,7 @@ SEPDIR=yes
 # Which day do you want weekly backups? (1 to 7 where 1 is Monday)
 DOWEEKLY=6
 
-# Choose Compression type. (gzip or bzip2)
+# Choose Compression type. (gzip, bzip2 or xz)
 COMP=gzip
 
 # Compress communications between backup server and MySQL server?
@@ -180,7 +180,7 @@ fi
 # set the DOWEEKLY setting, this can be a value from 1 to 7 where 1 is Monday,
 # The default is 6 which means that weekly backups are done on a Saturday.
 #
-# COMP is used to choose the copmression used, options are gzip or bzip2.
+# COMP is used to choose the copmression used, options are gzip, bzip2 or xz.
 # bzip2 will produce slightly smaller files but is more processor intensive so
 # may take longer to complete.
 #
@@ -441,19 +441,31 @@ dbdump () {
 # Compression function plus latest copy
 SUFFIX=""
 compression () {
-if [ "$COMP" = "gzip" ]; then
-	gzip -f "$1"
-	echo
-	echo Backup Information for "$1"
-	gzip -l "$1.gz"
-	SUFFIX=".gz"
-elif [ "$COMP" = "bzip2" ]; then
-	echo Compression information for "$1.bz2"
-	bzip2 -f -v $1 2>&1
-	SUFFIX=".bz2"
-else
-	echo "No compression option set, check advanced settings"
-fi
+	case "$COMP" in
+		gzip)
+			gzip -f "$1"
+			echo
+			echo Backup Information for "$1"
+			gzip -l "$1.gz"
+			SUFFIX=".gz"
+			;;
+		bzip2)
+			echo Compression information for "$1.bz2"
+			bzip2 -f -v $1 2>&1
+			SUFFIX=".bz2"
+			;;
+		xz)
+			xz -f "$1"
+			echo
+			echo Backup Information for "$1"
+			xz -l "$1.xz"
+			SUFFIX=".xz"
+			;;
+		*)
+			echo "No compression option set, check advanced settings"
+			;;
+	esac
+
 if [ "$LATEST" = "yes" ]; then
 	cp $1$SUFFIX "$BACKUPDIR/latest/"
 fi	
diff --git a/debian/control b/debian/control
index 353b860..66d9f31 100644
--- a/debian/control
+++ b/debian/control
@@ -11,6 +11,7 @@ Homepage: http://sourceforge.net/projects/automysqlbackup/
 Package: automysqlbackup
 Architecture: all
 Recommends: mutt
+Suggests: bzip2, xz-utils
 Depends: ${misc:Depends}, mysql-client | virtual-mysql-client, bsd-mailx | mailx
 Description: daily, weekly and monthly backup for your MySQL database
  automysqlbackup creates backup every day, week and month for all of your MySQL
diff --git a/debian/defaults b/debian/defaults
index 549e87c..763d9a6 100644
--- a/debian/defaults
+++ b/debian/defaults
@@ -64,7 +64,7 @@ SEPDIR=yes
 # Which day do you want weekly backups? (1 to 7 where 1 is Monday)
 DOWEEKLY=6
 
-# Choose Compression type. (gzip or bzip2)
+# Choose Compression type. (gzip, bzip2 or xz)
 COMP=gzip
 
 # Compress communications between backup server and MySQL server?
diff --git a/debian/man/automysqlbackup.8 b/debian/man/automysqlbackup.8
index 6b9f8ff..a8e3793 100644
--- a/debian/man/automysqlbackup.8
+++ b/debian/man/automysqlbackup.8
@@ -65,7 +65,7 @@ Separate backup directory and file for each DB? (yes or no)
 Which day do you want weekly backups at? (1 to 7 where 1 is Monday)
 .TP
 \fBCOMP=\fPgzip
-Choose Compression type. (gzip or bzip2)
+Choose Compression type. (gzip, bzip2 or xz)
 .TP
 \fBCOMMCOMP=\fPno
 Compress communications between backup server and MySQL server?
-- 
2.1.4

Reply via email to