]> arthur.barton.de Git - bup.git/blob - t/lib.sh
Add tests for index --no-check-device, and support for t/mnt.
[bup.git] / t / lib.sh
1 # Assumes shell is Bash.
2
3 actually-root()
4 {
5     test "$(whoami)" == root -a -z "$FAKEROOTKEY"
6 }
7
8 force-delete()
9 {
10     # Try *hard* to delete $@.  Among other things, some systems have
11     # r-xr-xr-x for root and other system dirs.
12     rm -rf "$@" # Maybe we'll get lucky.
13     for f in "$@"; do
14         test -e "$@" || continue
15         chmod -R u+w "$@"
16         if [[ $(uname) =~ Linux ]]; then
17             chattr -fR = "$@"
18             setfacl -Rb "$@"
19         fi
20         rm -r "$@"
21         if test -e "$@"; then
22             return 1
23         fi
24     done
25 }