isar-installer: Generate textual output only in unattended mode.

Message ID 20250922164359.1322947-1-alexander.heinisch@siemens.com
State Under Review
Headers show
Series isar-installer: Generate textual output only in unattended mode. | expand

Commit Message

Heinisch, Alexander Sept. 22, 2025, 4:43 p.m. UTC
From: Alexander Heinisch <alexander.heinisch@siemens.com>

Dialog renders textual output unreadable, thus, useless.
Thus, logs output via a serial, or piped to a file are useless when combined with dialog.

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 .../files/usr/bin/deploy-image-wic.sh         | 52 ++++++++++---------
 1 file changed, 27 insertions(+), 25 deletions(-)

Patch

diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
index 333762f1..779ed34a 100755
--- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
@@ -157,32 +157,34 @@  version_ge() {
     fi
 }
 
-# Get bmap-tools version
-bmap_version=$(bmaptool --version | awk '{ print $NF }')
-
-if version_ge "$bmap_version" "3.6"; then
-    # Create a named pipe for progress communication
-    progress_pipe="/tmp/progress"
-    if ! mkfifo "$progress_pipe"; then
-        echo "Error: Failed to create named pipe $progress_pipe"
-        exit 1
-    fi
-
-    # Add psplash pipe to bmap_options
-    bmap_options="$bmap_options --psplash-pipe=$progress_pipe"
-    quiet_flag="-q"
-
-    # Initialize the dialog gauge and update it dynamically
-    (
-        while true; do
-            if read -r line < "$progress_pipe"; then
-                percentage=$(echo "$line" | awk '{ print $2 }')
-                echo "$percentage"
-            fi
-        done
-    ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
+if ! $installer_unattended; then
+    # Get bmap-tools version
+    bmap_version=$(bmaptool --version | awk '{ print $NF }')
+
+    if version_ge "$bmap_version" "3.6"; then
+        # Create a named pipe for progress communication
+        progress_pipe="/tmp/progress"
+        if ! mkfifo "$progress_pipe"; then
+            echo "Error: Failed to create named pipe $progress_pipe"
+            exit 1
+        fi
 
-    gauge_pid=$!
+        # Add psplash pipe to bmap_options
+        bmap_options="$bmap_options --psplash-pipe=$progress_pipe"
+        quiet_flag="-q"
+
+        # Initialize the dialog gauge and update it dynamically
+        (
+            while true; do
+                if read -r line < "$progress_pipe"; then
+                    percentage=$(echo "$line" | awk '{ print $2 }')
+                    echo "$percentage"
+                fi
+            done
+        ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
+
+        gauge_pid=$!
+    fi
 fi
 
 if ! bmaptool $quiet_flag copy $bmap_options "$installer_image_uri" "$installer_target_dev"; then