diff options
Diffstat (limited to 'scripts/overlay.sh.in')
-rw-r--r-- | scripts/overlay.sh.in | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/overlay.sh.in b/scripts/overlay.sh.in new file mode 100644 index 0000000..b53eea7 --- /dev/null +++ b/scripts/overlay.sh.in @@ -0,0 +1,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 |