"$TOP/bup" "$@"
}
+force-delete()
+{
+ chmod -R u+w "$@"
+ for f in "$@"; do
+ test -e "$@" || continue
+ chattr -fR = "$@" || true
+ setfacl -Rb "$@"
+ rm -r "$@"
+ done
+}
+
WVSTART "init"
#set -x
-rm -rf "$BUP_DIR"
+force-delete "$BUP_DIR"
WVPASS bup init
WVSTART "index"
D=bupdata.tmp
-rm -rf $D
+force-delete $D
mkdir $D
WVFAIL bup index --exclude-from $D/cannot-exist $D
WVPASSEQ "$(bup index --check -p)" ""
) || exit 1
WVSTART "restore"
-rm -rf buprestore.tmp
+force-delete buprestore.tmp
WVFAIL bup restore boink
touch $TOP/$D/$D
bup index -u $TOP/$D
bup save -n master /
WVPASS bup restore -C buprestore.tmp "/master/latest/$TOP/$D"
WVPASSEQ "$(ls buprestore.tmp)" "bupdata.tmp"
-rm -rf buprestore.tmp
+force-delete buprestore.tmp
WVPASS bup restore -C buprestore.tmp "/master/latest/$TOP/$D/"
touch $D/non-existent-file buprestore.tmp/non-existent-file # else diff fails
WVPASS diff -ur $D/ buprestore.tmp/
(
tmp=testrestore.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
WVPASS t/compare-trees $tmp/src/ $tmp/restore/latest/
WVSTART "restore /foo/latest/"
- rm -rf "$tmp/restore"
+ force-delete "$tmp/restore"
WVPASS bup restore -C $tmp/restore /foo/latest/
for x in $tmp/src/*; do
WVPASS t/compare-trees $x/ $tmp/restore/$(basename $x);
done
WVSTART "restore /foo/latest/."
- rm -rf "$tmp/restore"
+ force-delete "$tmp/restore"
WVPASS bup restore -C $tmp/restore /foo/latest/.
WVPASS t/compare-trees $tmp/src/ $tmp/restore/
WVSTART "restore /foo/latest/x"
- rm -rf "$tmp/restore"
+ force-delete "$tmp/restore"
WVPASS bup restore -C $tmp/restore /foo/latest/x
WVPASS t/compare-trees $tmp/src/x/ $tmp/restore/x/
WVSTART "restore /foo/latest/x/"
- rm -rf "$tmp/restore"
+ force-delete "$tmp/restore"
WVPASS bup restore -C $tmp/restore /foo/latest/x/
for x in $tmp/src/x/*; do
WVPASS t/compare-trees $x/ $tmp/restore/$(basename $x);
done
WVSTART "restore /foo/latest/x/."
- rm -rf "$tmp/restore"
+ force-delete "$tmp/restore"
WVPASS bup restore -C $tmp/restore /foo/latest/x/.
WVPASS t/compare-trees $tmp/src/x/ $tmp/restore/
) || WVFAIL
WVSTART "exclude-bupdir"
D=exclude-bupdir.tmp
-rm -rf $D
+force-delete $D
mkdir $D
export BUP_DIR="$D/.bup"
WVPASS bup init
WVSTART "exclude"
D=exclude.tmp
-rm -rf $D
+force-delete $D
mkdir $D
export BUP_DIR="$D/.bup"
WVPASS bup init
echo "$D/d
$TOP/$D/g
$D/h" > $EXCLUDE_FILE
-rm -rf $D
+force-delete $D
mkdir $D
export BUP_DIR="$D/.bup"
WVPASS bup init
WVSTART "save --strip"
(
tmp=graft-points.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
WVSTART "save --strip-path (relative)"
(
tmp=graft-points.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
WVSTART "save --strip-path (absolute)"
(
tmp=graft-points.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
WVSTART "save --strip-path (no match)"
(
tmp=graft-points.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
WVSTART "save --graft (empty graft points disallowed)"
(
tmp=graft-points.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
WVSTART "save --graft /x/y=/a/b (relative paths)"
(
tmp=graft-points.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
WVSTART "save --graft /x/y=/a/b (matching structure)"
(
tmp=graft-points.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
WVSTART "save --graft /x/y=/a (shorter target)"
(
tmp=graft-points.tmp
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
export BUP_DIR="$(pwd)/$tmp/bup"
WVPASS bup init
(
tmp=graft-points.tmp
export BUP_DIR="$(pwd)/$tmp/bup"
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
WVPASS bup init
mkdir -p $tmp/src/x/y/z
(
tmp=graft-points.tmp
export BUP_DIR="$(pwd)/$tmp/bup"
- rm -rf $tmp
+ force-delete $tmp
mkdir $tmp
WVPASS bup init
mkdir -p $tmp/src/x/y/z
D=indexfile.tmp
INDEXFILE=tmpindexfile.tmp
rm -f $INDEXFILE
-rm -rf $D
+force-delete $D
mkdir $D
export BUP_DIR="$D/.bup"
WVPASS bup init
WVSTART "import-rsnapshot"
D=rsnapshot.tmp
export BUP_DIR="$TOP/$D/.bup"
-rm -rf $D
+force-delete $D
mkdir $D
WVPASS bup init
mkdir -p $D/hourly.0/buptest/a
WVSTART "import-rdiff-backup"
D=rdiff-backup.tmp
export BUP_DIR="$TOP/$D/.bup"
- rm -rf $D
+ force-delete $D
mkdir $D
WVPASS bup init
mkdir $D/rdiff-backup
WVSTART "compression"
D=compression0.tmp
export BUP_DIR="$TOP/$D/.bup"
-rm -rf $D
+force-delete $D
mkdir $D
WVPASS bup init
WVPASS bup index $TOP/Documentation
D=compression9.tmp
export BUP_DIR="$TOP/$D/.bup"
-rm -rf $D
+force-delete $D
mkdir $D
WVPASS bup init
WVPASS bup index $TOP/Documentation
exit 0
fi
D=bupdata.tmp
- rm -rf $D
+ force-delete $D
mkdir -p $D/x
date > $D/x/1
tmpdir="$(mktemp -d /tmp/bup-test-XXXXXXX)"
- cleanup() { set -x; rm -rf "${tmpdir}"; set +x; }
+ cleanup() { set -x; force-delete "${tmpdir}"; set +x; }
trap cleanup EXIT
date > "$tmpdir/2"
export BUP_DIR="$TOP/buptest.tmp"
- rm -rf "$BUP_DIR"
+ force-delete "$BUP_DIR"
WVPASS bup init
WVPASS bup index -vu $(pwd)/$D/x "$tmpdir"
WVSTART "clear-index"
D=clear-index.tmp
export BUP_DIR="$TOP/$D/.bup"
-rm -rf $TOP/$D
+force-delete $TOP/$D
mkdir $TOP/$D
WVPASS bup init
touch $TOP/$D/foo