-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmount.posixovlfs
executable file
·63 lines (56 loc) · 939 Bytes
/
mount.posixovlfs
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# fstab-compatible mount script for posix-overlay fs
# example invocation:
# /sbin/mount.posixovlfs /mnt/vol/lower /mnt/vol/upper -o rw,default
set -e
set -o pipefail
set -u
sourcestring=$1
shift
targetdir=$1
shift
options=''
while [ $# -gt 0 ]
do
case "$1" in
-o)
shift
options=$1
;;
*)
echo "unknown parameter: $1" >&2
exit 1
;;
esac
shift
done
if [[ $sourcestring =~ posixovl:(.+) ]]
then
sourcedir=${BASH_REMATCH[1]}
else
sourcedir=$sourcestring
fi
declare -a opts=()
fuse_options=''
IFS=','
for opt in $options
do
case "$opt" in
default|rw) true;;
ro) echo "readonly is not supported" >&2
exit 2
;;
assume_vfat)
opts+=(-F)
;;
*) fuse_options="$fuse_options${fuse_options:+,}$opt"
;;
esac
done
IFS=$' \t\n'
if [ -z "$fuse_options" ]
then
mount.posixovl "${opts[@]}" -S "$sourcedir" "$targetdir"
else
mount.posixovl "${opts[@]}" -S "$sourcedir" "$targetdir" -- "$fuse_options"
fi