From 03e6a6709dbec68f75b0b71038ef5ca9dbbc22f8 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Tue, 19 Nov 2013 15:26:02 +1300 Subject: [PATCH] Bug 10735 - prevent script aborting if backupdir undefined Older versions of Koha didn't have ... defined in koha-conf.xml. The koha-dump script is aware of this, and checks to see if it's there. However, if it's not, xmlstarlet returns a non-0 error code which causes the script to abort due to running under set -e. Test plan: * Remove backupdir from koha-conf.xml * Run koha-dump, notice that it doesn't do backups * Apply patch * Run koha-dump again, notice that it does do backups Signed-off-by: Tomas Cohen Arazi The fallback method works as described. It might be made more robust like checking for dir existence (thinking of older instances upgrades). But it certaintly belongs to another bug report. --- debian/scripts/koha-dump | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump index 2fe9edd..02aeb93 100755 --- a/debian/scripts/koha-dump +++ b/debian/scripts/koha-dump @@ -44,7 +44,7 @@ mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )" mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )" mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )" mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" -backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig )" +backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )" [ -z "$backupdir" ] && backupdir="/var/spool/koha/$name" dbdump="$backupdir/$name-$date.sql.gz" echo "* DB to $dbdump" -- 1.8.3.2