]> arthur.barton.de Git - bup.git/blob - t/lib.sh
Currently bup only indexes physical parent paths; adjust tests.
[bup.git] / t / lib.sh
1 # Assumes shell is Bash.
2
3 force-delete()
4 {
5     # Try *hard* to delete $@.  Among other things, some systems have
6     # r-xr-xr-x for root and other system dirs.
7     rm -rf "$@" # Maybe we'll get lucky.
8     for f in "$@"; do
9         test -e "$@" || continue
10         chmod -R u+w "$@"
11         if [[ $(uname) =~ Linux ]]; then
12             chattr -fR = "$@"
13             setfacl -Rb "$@"
14         fi
15         rm -r "$@"
16         if test -e "$@"; then
17             return 1
18         fi
19     done
20 }
21
22 realpath()
23 (
24     set -e;
25     test "$#" -eq 1
26     script_home=$(cd "$(dirname $0)" && pwd)
27     echo "$1" | \
28         PYTHONPATH="${script_home}/../lib" python -c \
29         "import sys, bup.helpers; print bup.helpers.realpath(sys.stdin.readline())"
30 )