Patchwork [3/4] initscripts: fix read-only-rootfs-hook.sh to avoid using unionfs

login
register
mail settings
Submitter Paul Eggleton
Date April 10, 2013, 3:42 p.m.
Message ID <0ed65e5bbc29236f77d84ae7c594874d6b627056.1365608262.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/47839/
State Accepted
Commit 1b7785c5379c0abf38005abd056409fcde4e0c38
Headers show

Comments

Paul Eggleton - April 10, 2013, 3:42 p.m.
Unionfs isn't available everywhere, and we can get similar results (if
not quite as neatly) by using bind mounts + tmpfs and copying the data
over.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 .../initscripts-1.0/read-only-rootfs-hook.sh            |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Patch

diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
index 3a295ee..4f3e0d9 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
@@ -4,16 +4,9 @@ 
 
 [ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
 
-# Make sure unionfs is in /proc/filesystems
-if ! grep -q unionfs /proc/filesystems; then
-    echo "ERROR: unionfs not supported by kernel!"
-    exit 1
+if [ "$1" = "start" ] ; then
+	mkdir -p /var/volatile/lib
+	cp -a /var/lib/* /var/volatile/lib
+	mount --bind /var/volatile/lib /var/lib
 fi
 
-mkdir -p /var/volatile/lib
-mount -t unionfs -o dirs=/var/volatile/lib:/var/lib=ro none /var/lib
-
-if [ $? != 0 ]; then
-    echo "ERROR: Union mount failed!"
-    exit 1
-fi