1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-06 13:18:07 +03:00
samba-mirror/source4/selftest/provisions/dump.sh
Andreas Schneider df29b9ab16 s4:selftest: Reformat shell scripts
shfmt -f source4/selftest/ | xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-07-15 12:08:36 +00:00

48 lines
766 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