meta-isar: Added support for nfs based rootfs in deploy-image-wic (isar-image-installer).

Message ID 20240828111946.112454-1-alexander.heinisch@siemens.com
State Superseded, archived
Headers show
Series meta-isar: Added support for nfs based rootfs in deploy-image-wic (isar-image-installer). | expand

Commit Message

alexander.heinisch Aug. 28, 2024, 11:19 a.m. UTC
From: Alexander Heinisch <alexander.heinisch@siemens.com>

When AUTO_INSTALL is not used, the script tries to resolve possible target devices to
install the wic image to. To not overwrite the device hosting the current root
we are using, it tries to detect the current root. Which works fine when a local device
is used but does not work in the case of nfs. (most probably it won't work for cifs as well)

With this patch we are detecting nfs based mounts of / before the local device tailored handling
is applied and bypass the breaking parts (in this particular case readlink).

Thus, in case of an nfs the current root device will be "nfs".

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 .../deploy-image/files/deploy-image-wic.sh            | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Patch

diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 8b25b1d2..f8ce1d27 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -47,8 +47,15 @@  DISK_BMAP=$(find "$installdata" -type f -iname "${DISK_IMAGE%.wic*}.wic.bmap")
 
 if ! $AUTO_INSTALL; then
     target_device_list=""
-    current_root_dev=$(readlink -f "$(findmnt / -o source -n)")
-    current_root_dev=${current_root_dev#\/dev/}
+    current_root_dev=$(findmnt / -o source -n)
+    current_root_dev_type=$(findmnt / -o fstype -n)
+    if [ ${current_root_dev_type} = "nfs" ]; then
+        current_root_dev="nfs"
+    else
+        current_root_dev=$(readlink -f "${current_root_dev}")
+        current_root_dev=${current_root_dev#\/dev/}
+    fi
+
     case $current_root_dev in
         mmcblk*)
             ;;