aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-06 22:18:02 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-07 01:33:58 +0200
commitd0764e77b265bc1fc99456ddd3d3e3a088ef1f78 (patch)
treee8304056143d8fd49074ee9431eb1c722b21fc46 /scripts
parent4f4a377d7acb555193566db3ee459adc19e2e6a5 (diff)
Add pygos specific overlay fs setup
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makemodule.am2
-rw-r--r--scripts/overlay.sh.in21
2 files changed, 22 insertions, 1 deletions
diff --git a/scripts/Makemodule.am b/scripts/Makemodule.am
index e6de18d..d09b603 100644
--- a/scripts/Makemodule.am
+++ b/scripts/Makemodule.am
@@ -1,2 +1,2 @@
scriptdir = @SCRIPTDIR@
-script_SCRIPTS = scripts/devfs.sh scripts/trymount.sh
+script_SCRIPTS = scripts/devfs.sh scripts/trymount.sh scripts/overlay.sh
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