diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-09-21 18:52:21 -0700 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-09-22 14:39:50 -0700 |
commit | 9b8e174fe8cac61cfcfa1c76e8cab2450e4a0af5 (patch) | |
tree | b5c8a50bc395bb2d431d9cbf3d4439e1ac0bd231 | |
parent | 9e1dde15f9d3a374747d163e37016b54f008bd9f (diff) | |
download | samba-9b8e174fe8cac61cfcfa1c76e8cab2450e4a0af5.tar.gz samba-9b8e174fe8cac61cfcfa1c76e8cab2450e4a0af5.tar.bz2 samba-9b8e174fe8cac61cfcfa1c76e8cab2450e4a0af5.zip |
selftest: Add script to assist in writing out a tree undump.sh can restore
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
-rwxr-xr-x | source4/selftest/provisions/dump.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/source4/selftest/provisions/dump.sh b/source4/selftest/provisions/dump.sh new file mode 100755 index 0000000000..3616d56b28 --- /dev/null +++ b/source4/selftest/provisions/dump.sh @@ -0,0 +1,48 @@ +#!/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=$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=$f.dump + echo "Dumping $f to $outname" + $TDBDUMP $f > $outname || { + echo "Failed to dump to $outname" + exit 1 + } + rm -f $f +done +exit 0 |