installer: Auto-select image when only one is available

Message ID 20260715101748.2873544-1-shivaschandra.k-l@siemens.com
State New
Headers show
Series installer: Auto-select image when only one is available | expand

Commit Message

Shivaschandra KL July 15, 2026, 10:17 a.m. UTC
Currently, the image selection dialog is always shown,
even when only a single image is available. Even when the single
image is availble, first window asks to select image and second window
asks to start installation of same image.No selection required if there
is only one image.

This change modifies ui_select_image_menu() to automatically select the
image when only one installable entry is found, while preserving the
dialog for multiple images.

Benefits:
- Improved user experience for single-image installations
- Maintains existing behavior for multi-image scenarios

Signed-off-by: Shivaschandra KL <shivaschandra.k-l@siemens.com>
---
 .../deploy-image/files/usr/bin/installer_ui.sh         | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/installer_ui.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/installer_ui.sh
index 9d3ba5de..133d7c70 100644
--- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/installer_ui.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/installer_ui.sh
@@ -66,7 +66,8 @@  ui_countdown_allow_attended_switch() {
 # ui_select_image_menu <install_data_dir>
 #
 # Uses sys_list_installable_entries backend API and returns selected
-# relative image path on stdout.
+# relative image path on stdout. If only one image is available, it is
+# automatically selected without showing a dialog.
 #--------------------------------------------------------------------------
 ui_select_image_menu() {
     local install_data_dir="$1"
@@ -83,6 +84,13 @@  ui_select_image_menu() {
         return 1
     fi
 
+    # If only one image is available, select it automatically
+    if [ "${#list[@]}" -eq 2 ]; then  # list has pairs: path and description
+        echo "${list[0]}"
+        return 0
+    fi
+
+    # Multiple images available, show selection dialog
     selected=$(dialog --no-tags \
         --menu "Select image to be installed" 12 70 6 \
         "${list[@]}" --output-fd 1) || return 2