public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] meta-isar: Added support for nfs based rootfs in deploy-image-wic (isar-image-installer).
@ 2024-08-28 11:19 alexander.heinisch via isar-users
  0 siblings, 0 replies; 3+ messages in thread
From: alexander.heinisch via isar-users @ 2024-08-28 11:19 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, Alexander Heinisch

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(-)

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*)
             ;;
-- 
2.43.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/20240828111946.112454-1-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] meta-isar: Added support for nfs based rootfs in deploy-image-wic (isar-image-installer).
  2024-08-28 11:46 alexander.heinisch via isar-users
@ 2024-09-04  8:23 ` Uladzimir Bely
  0 siblings, 0 replies; 3+ messages in thread
From: Uladzimir Bely @ 2024-09-04  8:23 UTC (permalink / raw)
  To: alexander.heinisch, isar-users; +Cc: jan.kiszka

On Wed, 2024-08-28 at 13:46 +0200, alexander.heinisch via isar-users
wrote:
> 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             | 10
> ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> 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..95188fe3 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,14 @@ 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_type=$(findmnt / -o fstype -n)
> +    if [ ${current_root_dev_type} = "nfs" ]; then
> +        current_root_dev="nfs"
> +    else
> +        current_root_dev=$(readlink -f "$(findmnt / -o source -n)")
> +        current_root_dev=${current_root_dev#\/dev/}
> +    fi
> +
>      case $current_root_dev in
>          mmcblk*)
>              ;;
> -- 
> 2.43.0
> 

Applied to next, thanks.

-- 
Best regards,
Uladzimir.



-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/022c84b4d1297d88a552509cee74497217dce6d6.camel%40ilbers.de.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] meta-isar: Added support for nfs based rootfs in deploy-image-wic (isar-image-installer).
@ 2024-08-28 11:46 alexander.heinisch via isar-users
  2024-09-04  8:23 ` Uladzimir Bely
  0 siblings, 1 reply; 3+ messages in thread
From: alexander.heinisch via isar-users @ 2024-08-28 11:46 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, Alexander Heinisch

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             | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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..95188fe3 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,14 @@ 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_type=$(findmnt / -o fstype -n)
+    if [ ${current_root_dev_type} = "nfs" ]; then
+        current_root_dev="nfs"
+    else
+        current_root_dev=$(readlink -f "$(findmnt / -o source -n)")
+        current_root_dev=${current_root_dev#\/dev/}
+    fi
+
     case $current_root_dev in
         mmcblk*)
             ;;
-- 
2.43.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/20240828114615.123711-1-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-04  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-28 11:19 [PATCH] meta-isar: Added support for nfs based rootfs in deploy-image-wic (isar-image-installer) alexander.heinisch via isar-users
2024-08-28 11:46 alexander.heinisch via isar-users
2024-09-04  8:23 ` Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox