Patchwork [13/17] initramfs-module-block: use ROOT_DEVICE mountpoint if available

login
register
mail settings
Submitter Otavio Salvador
Date May 30, 2011, 2:54 p.m.
Message ID <1306767263-29895-14-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/5065/
State New, archived
Headers show

Comments

Otavio Salvador - May 30, 2011, 2:54 p.m.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 recipes/initrdscripts/files/85-blockboot.sh        |    9 +++++++--
 .../initrdscripts/initramfs-module-block_1.0.bb    |    2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

Patch

diff --git a/recipes/initrdscripts/files/85-blockboot.sh b/recipes/initrdscripts/files/85-blockboot.sh
index 7841ac6..07c1c35 100644
--- a/recipes/initrdscripts/files/85-blockboot.sh
+++ b/recipes/initrdscripts/files/85-blockboot.sh
@@ -7,6 +7,11 @@  if [ -e "$ROOT_DEVICE" ]; then
     if [ -n "$ROOT_FSTYPE" ]; then
 	type="-t $ROOT_FSTYPE"
     fi
-    mount $type "$ROOT_DEVICE" /mnt || fatal "Unable to mount rootfs device"
-    BOOT_ROOT=/mnt
+
+    if ! mount | grep -q "$ROOT_DEVICE"; then
+        mount $type "$ROOT_DEVICE" /mnt || fatal "Unable to mount rootfs device"
+        BOOT_ROOT=/mnt
+    else
+        BOOT_ROOT=`expr "$(mount | grep $ROOT_DEVICE)" : '.* on \([^ ]*\)'`
+    fi
 fi
diff --git a/recipes/initrdscripts/initramfs-module-block_1.0.bb b/recipes/initrdscripts/initramfs-module-block_1.0.bb
index f7834f0..a21a681 100644
--- a/recipes/initrdscripts/initramfs-module-block_1.0.bb
+++ b/recipes/initrdscripts/initramfs-module-block_1.0.bb
@@ -1,5 +1,5 @@ 
 SRC_URI = "file://85-blockboot.sh"
-PR = "r5"
+PR = "r6"
 RDEPENDS_${PN} = "initramfs-uniboot"
 DESCRIPTION = "An initramfs module for booting off normal block devices."