]> arthur.barton.de Git - bup.git/blob - t/force-delete
test-restore-map-owner: accommodate python 3 and test there
[bup.git] / t / force-delete
1 #!/usr/bin/env bash
2
3 set -o pipefail
4
5 # Try *hard* to delete $@.  Among other things, some systems have
6 # r-xr-xr-x for root and other system dirs.
7
8 rc=0
9 rm -rf "$@" # Maybe we'll get lucky.
10 for f in "$@"; do
11     test -e "$f" || continue
12     if test "$(type -p setfacl)"; then
13         setfacl -Rb "$f"
14     fi
15     if test "$(type -p chattr)"; then
16         chattr -R -aisu "$f"
17     fi
18     chmod -R u+rwX "$f"
19     rm -r "$f"
20     if test -e "$f"; then
21         rc=1
22         find "$f" -ls
23         lsattr -aR "$f"
24         getfacl -R "$f"
25     fi
26 done
27
28 if test "$rc" -ne 0; then
29     echo "Failed to delete everything" 1>&2
30 fi
31
32 exit "$rc"