VERSION: Bump version up to 4.4.8...
[Samba.git] / source4 / selftest / provisions / undump.sh
blob7ffea3eff70af927455fcd2a006e213276b1e76b
1 #!/bin/sh
2 # undump a provision directory
4 [ "$#" -gt 0 ] || {
5 echo "Usage: undump.sh <DIRECTORY> [TARGETDIR] [TDBRESTORE]"
6 exit 1
9 TDBRESTORE=tdbrestore
10 [ "$#" -lt 3 ] || {
11 TDBRESTORE=$3
15 dirbase="$1"
17 TARGETDIR=`pwd`/$dirbase
19 cd $dirbase
21 [ "$#" -lt 2 ] || {
22 TARGETDIR=$2
25 for f in $(find . -name '*.dump'); do
26 dname=$TARGETDIR/$(dirname $f)
27 mkdir -p $dname
28 bname=$(basename $f .dump)
29 outname=$dname/$bname
30 echo "Restoring $outname"
31 rm -f $outname
32 $TDBRESTORE $outname < $f || {
33 echo "Failed to restore $outname"
34 exit 1
36 done
37 exit 0