1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-20 14:03:59 +03:00
Douglas Bagnall d8e7ffd029 s4/selftest/provisions/dump.sh: dump to target dir if supplied
This is clearly what was meant to happen.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-07-15 10:01:29 +02:00

49 lines
818 B
Bash
Executable File

#!/bin/sh
# dump a provision directory
[ "$#" -gt 0 ] || {
echo "Usage: dump.sh <DIRECTORY> [TARGETDIR] [TDBDUMP]"
exit 1
}
TDBDUMP=tdbdump
[ "$#" -lt 3 ] || {
TDBDUMP=$3
}
dirbase="$1"
TARGETDIR=`pwd`/$dirbase
cd $dirbase
[ "$#" -lt 2 ] || {
TARGETDIR=$2
}
for f in $(find . -name '*.tdb'); do
dname=$TARGETDIR/$(dirname $f)
mkdir -p $dname
outname=$dname/$(basename $f).dump
echo "Dumping $f to $outname"
$TDBDUMP $f > $outname || {
echo "Failed to dump to $outname"
exit 1
}
rm -f $f
done
for f in $(find . -name '*.ldb'); do
dname=$TARGETDIR/$(dirname $f)
mkdir -p $dname
outname=$dname/$(basename $f).dump
echo "Dumping $f to $outname"
$TDBDUMP $f > $outname || {
echo "Failed to dump to $outname"
exit 1
}
rm -f $f
done
exit 0