diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-11-05 15:28:18 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-11-05 16:11:47 +0100 |
commit | 021fa432447bd7b447ca39738040698db39d751b (patch) | |
tree | 66c0e46dfd952ce6de6043916f3eb9e2d92e62e2 /scripts/overlay.sh |
Initial commitv1
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'scripts/overlay.sh')
-rwxr-xr-x | scripts/overlay.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/overlay.sh b/scripts/overlay.sh new file mode 100755 index 0000000..090671c --- /dev/null +++ b/scripts/overlay.sh @@ -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 + mkdir -p "$work" + mount -t overlay overlay \ + -olowerdir=${lower},upperdir=${upper},workdir=${work} \ + ${target} + else + mount --bind "$lower" "$target" + fi +fi |