]> arthur.barton.de Git - bup.git/blob - t/configure-sampledata
79bf8a44f49411ef032c4503c07390b41b8ce787
[bup.git] / t / configure-sampledata
1 #!/usr/bin/env bash
2
3 top=$(pwd)
4
5 usage()
6 {
7     echo 'Usage: t/configure-sampledata [--setup | --clean]'
8 }
9
10 if test "$#" -ne 1; then
11     usage 1>&2; exit 1
12 fi
13
14 case "$1" in
15     '--setup')
16         (
17             cd t/sampledata || exit $?
18             ln -sf a b || exit $?
19             ln -sf b c || exit $?
20             ln -sf /etc . || exit $?
21         ) || exit $?
22         ;;
23     '--clean')
24         (
25             cd t/sampledata || exit $?
26             # test -e is false for dangling symlinks.
27             if test -h b -o -e b; then rm b || exit $?; fi
28             if test -h c -o -e c; then rm c || exit $?; fi
29             if test -h etc -o -e etc; then rm etc || exit $?; fi
30         )
31         ;;
32     *)
33         usage 1>&2; exit 1
34         ;;
35 esac