diff options
-rwxr-xr-x | source4/selftest/provisions/undump.sh | 27 |
1 files changed, 22 insertions, 5 deletions
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 <DIRECTORY>" +[ "$#" -gt 0 ] || { + echo "Usage: undump.sh <DIRECTORY> [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 } |