From 7d929eb3071449079828d7dc7e6c6cd6786ae4da 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. Signed-off-by: Jonathan Druart As Tomas said, it would be better to alert the user if the backupdir tag does not exist (or contains a nonexistent directory) in the config file. --- 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.7.10.4