[05/17] meta-isar: deploy-image: Fix bmap support

Message ID a2f24ebac8f13e83f1e5a4763d2755be6eb88c97.1719927511.git.jan.kiszka@siemens.com
State Accepted, archived
Headers show
Series Reworks, fixes and unattended mode for image installer | expand

Commit Message

Jan Kiszka July 2, 2024, 1:38 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

If the to-be-installed image was compressed, its corresponding .bmap
file was not found. Fix that and also ensure that bmaptool is correctly
invoked if --nobmap does not have to be inserted.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../deploy-image/files/deploy-image-wic.sh                | 8 ++++----
 1 file changed, 4 insertions(+), 4 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 9a1fa651..d27a0189 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
@@ -6,7 +6,7 @@ 
 
 installdata=${INSTALL_DATA:-/install}
 
-DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap")
+DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
 if [ -z "$DISK_IMAGE" ]; then
     pushd "$installdata"
     shopt -s nullglob
@@ -17,11 +17,11 @@  if [ -z "$DISK_IMAGE" ]; then
                 "${array[@]}" --output-fd 1)
     popd
 fi
-if [ ! -f "$DISK_IMAGE" ]; then
+if [ ! -f "$installdata/$DISK_IMAGE" ]; then
     dialog --msgbox "Could not find an image to install. Installation aborted." 7 60
     exit 1
 fi
-DISK_BMAP=$(find "$installdata" -type f -iname "$DISK_IMAGE.bmap")
+DISK_BMAP=$(find "$installdata" -type f -iname "${DISK_IMAGE%.wic*}.wic.bmap")
 # inspired by poky/meta/recipes-core/initrdscripts/files/install-efi.sh
 
 target_device_list=""
@@ -95,7 +95,7 @@  if [ -z "$DISK_BMAP" ]; then
     bmap_options="--nobmap"
 fi
 clear
-if ! bmaptool copy "${bmap_options}" "$DISK_IMAGE" "/dev/${TARGET_DEVICE}"; then
+if ! bmaptool copy ${bmap_options} "$installdata/$DISK_IMAGE" "/dev/${TARGET_DEVICE}"; then
     exit 1
 fi