diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-09-21 18:52:21 -0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2013-09-27 09:28:57 +0200 |
commit | 476e03ebac0d1d7b969faab5c1fb49e844d6a9e9 (patch) | |
tree | 89feeaec2667a2d060d7c277c311ba36739d0c79 /source4 | |
parent | 3f2907f0eb947f2673b7c9fef5ef3de4154def20 (diff) | |
download | samba-476e03ebac0d1d7b969faab5c1fb49e844d6a9e9.tar.gz |
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>
(cherry picked from commit 9b8e174fe8cac61cfcfa1c76e8cab2450e4a0af5)
Diffstat (limited to 'source4')
-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 |