summaryrefslogtreecommitdiff
path: root/scripts/overlay.sh.in
blob: b53eea73df850207b309b0bd7899e2cc3864c368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

lower=/cfg/preserve/${1}
upper=/cfg/overlay/${1}
work=/cfg/overlay/${1}_work
target=${2}

if [ ! -d "$target" ]; then
	exit
fi

if [ -d "$lower" ]; then
	if [ -d "$upper" ]; then
		@BINPATH@/mkdir -p "$work"
		@SBINPATH@/mount -t overlay overlay \
			-olowerdir=${lower},upperdir=${upper},workdir=${work} \
			${target}
	else
		@SBINPATH@/mount --bind "$lower" "$target"
	fi
fi