1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

selftest: Add targetdir and tdbrestore parameters to undump.sh

This commit is contained in:
Andrew Bartlett 2012-06-16 11:06:59 +10:00
parent 7a723c6b38
commit 72953b1eb8

View File

@ -1,18 +1,35 @@
#!/bin/sh #!/bin/sh
# undump a provision directory # undump a provision directory
[ "$#" -eq 1 ] || { [ "$#" -gt 0 ] || {
echo "Usage: undump.sh <DIRECTORY>" echo "Usage: undump.sh <DIRECTORY> [TARGETDIR] [TDBRESTORE]"
exit 1 exit 1
} }
TDBRESTORE=tdbrestore
[ "$#" -lt 3 ] || {
TDBRESTORE=$3
}
dirbase="$1" 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) bname=$(basename $f .dump)
outname=$dname/$bname outname=$dname/$bname
echo "Restoring $outname" echo "Restoring $outname"
rm -f $outname rm -f $outname
bin/tdbrestore $outname < $f || { $TDBRESTORE $outname < $f || {
echo "Failed to restore $outname" echo "Failed to restore $outname"
exit 1 exit 1
} }