summaryrefslogtreecommitdiff
path: root/filesystems/webdavfs/files/mount_webdavfs.in
blob: a8600c2c88ef767c22c8c12475d015bace2a10b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

mountprog=%%PREFIX%%/sbin/mount.webdavfs

while getopts "fo:DF:T:" opt
do
  case "$opt" in
  o)	case "$OPTARG" in
	username=*)		username=${OPTARG#username=}	;;
	password=*)		password=${OPTARG#password=}	;;
	rw)							;;
	*)			options="$options,$OPTARG"	;;
	esac ;;
  T)	traceopts="$traceopts,$OPTARG"	;;
  *)	flags="$flags -$opt $OPTARG"	;;
  esac
done
shift $((OPTIND - 1))

[ -n "$username" ] && options="$options,username=$username"
[ -n "$password" ] && options="$options,password=$password"
options=${options#,}

traceopts=${traceopts#,}
[ -n "$traceopts" ] && flags="$flags -T $traceopts"

if [ -z "$options" ]; then
  exec $mountprog $flags "$@"
else
  exec $mountprog $flags -o "$options" "$@"
fi