From: Robin Sheat Date: Tue, 19 Nov 2013 02:26:02 +0000 (+1300) Subject: Bug 10735: prevent koha-dump from aborting if backupdir undefined X-Git-Tag: v3.16.00-beta~1028 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=266f2a3a9f3d67fed0e0b35d267419a901345b92;p=koha_fer Bug 10735: prevent koha-dump from 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 certainly 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. Signed-off-by: Galen Charlton --- diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump index 2fe9edddeb..02aeb938bd 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"