From 72953b1eb8fa42257c7f8eff603e04c953fac361 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 16 Jun 2012 11:06:59 +1000 Subject: selftest: Add targetdir and tdbrestore parameters to undump.sh --- source4/selftest/provisions/undump.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'source4/selftest/provisions') diff --git a/source4/selftest/provisions/undump.sh b/source4/selftest/provisions/undump.sh index 07408b7ea6..7ffea3eff7 100755 --- a/source4/selftest/provisions/undump.sh +++ b/source4/selftest/provisions/undump.sh @@ -1,18 +1,35 @@ #!/bin/sh # undump a provision directory -[ "$#" -eq 1 ] || { - echo "Usage: undump.sh " +[ "$#" -gt 0 ] || { + echo "Usage: undump.sh [TARGETDIR] [TDBRESTORE]" exit 1 } + +TDBRESTORE=tdbrestore +[ "$#" -lt 3 ] || { + TDBRESTORE=$3 +} + + dirbase="$1" -for f in $(find $dirbase -name '*.dump'); do - dname=$(dirname $f) + +TARGETDIR=`pwd`/$dirbase + +cd $dirbase + +[ "$#" -lt 2 ] || { + TARGETDIR=$2 +} + +for f in $(find . -name '*.dump'); do + dname=$TARGETDIR/$(dirname $f) + mkdir -p $dname bname=$(basename $f .dump) outname=$dname/$bname echo "Restoring $outname" rm -f $outname - bin/tdbrestore $outname < $f || { + $TDBRESTORE $outname < $f || { echo "Failed to restore $outname" exit 1 } -- cgit