From: Ralph Ronnquist <ralph.ronnquist@gmail.com>
Date: Thu, 29 Sep 2022 10:30:23 +0000 (+1000)
Subject: Added subdirectory sharing as configuration feature.
X-Git-Tag: v0.1.8~4
X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=a55dec2999e4c8b2ec82671d2f90f065c298e241;p=rrq%2Foverlay-boot.git

Added subdirectory sharing as configuration feature.
---

diff --git a/functions b/functions
index bc65448..ddcd97d 100644
--- a/functions
+++ b/functions
@@ -150,6 +150,17 @@ setup_overlay() {
 	mount --bind $UPPER $LOWER
     fi
 
+    grep ^SHARE= "$CONFIG" | while read A ; do
+        B="$(echo ${A#SHARE=})"
+        D="$(realpath "$LOWER$B")"
+        [ "$D" = "$LOWER" ] && continue
+        if [ -d "$D" ] ; then
+            echo bind mount $D onto $LIVE$D
+            mkdir -p $LIVE$D
+            mount --bind $D $LIVE$D
+        fi
+    done
+
     env CONFIG="$CONFIG" $POSTMOUNT "LIVE" "$UPPER" 
 }
 
diff --git a/overlay-boot.8.adoc b/overlay-boot.8.adoc
index 01ae709..974759e 100644
--- a/overlay-boot.8.adoc
+++ b/overlay-boot.8.adoc
@@ -166,6 +166,14 @@ This variable nominates the "work" directory for an overlay mount. It
 has to be a writable directory on the same mount device as the UPPER
 directory.
 
+*SHARE*::
+
+This variable nominates a pathname under $LOWER to bind-mount onto the
+same pathname under $LIVE so as to share that directory tree into the
+overlay. The SHARE variable is a special configuration variable in
+that the value does not allow exclamation mark evaluation, and that it
+may occur many times for declaring multiple shared subdirectories.
+
 Networking
 ----------