installer/deploy-image: Add disk size to image

Message ID 20240325153430.2099016-1-Quirin.Gylstorff@siemens.com
State Accepted, archived
Headers show
Series installer/deploy-image: Add disk size to image | expand

Commit Message

Quirin Gylstorff March 25, 2024, 3:33 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows the user to check if the correct image was selected.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../deploy-image/files/deploy-image-wic.sh                 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Uladzimir Bely April 9, 2024, 5:23 a.m. UTC | #1
On Mon, 2024-03-25 at 16:33 +0100, 'Quirin Gylstorff' via isar-users
wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This allows the user to check if the correct image was selected.
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  .../deploy-image/files/deploy-image-wic.sh                 | 7 ++++-
> --
>  1 file changed, 4 insertions(+), 3 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 6a28f6ef..8043aff1 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
@@ -77,7 +77,8 @@  fi
 if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
     array=()
     for target in $target_device_list; do
-        array+=("$target" "/dev/$target")
+        target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target")
+        array+=("$target" "/dev/$target $target_size")
     done
     TARGET_DEVICE=$(dialog --clear \
                 --no-tags --menu "Select device to install $DISK_IMAGE" 10 60 3 \
@@ -86,8 +87,8 @@  if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
 else
     TARGET_DEVICE=$(echo "$target_device_list" | tr -d " ")
 fi
-
-dialog --msgbox "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'." 7 60
+TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE /dev/"$TARGET_DEVICE")
+dialog --msgbox "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'(Size: '$TARGET_DEVICE_SIZE' )." 7 60
 
 set -e
 bmap_options=""