From 9b8e174fe8cac61cfcfa1c76e8cab2450e4a0af5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 21 Sep 2013 18:52:21 -0700 Subject: selftest: Add script to assist in writing out a tree undump.sh can restore Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher Reviewed-by: Michael Adam --- source4/selftest/provisions/dump.sh | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 source4/selftest/provisions/dump.sh 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 [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 -- cgit