From: "'Kasturi Shekar' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Kasturi Shekar <kasturi.shekar@siemens.com>
Subject: [PATCH v1 2/2] installer-ui: use sys_api backend for frontend dialogs
Date: Mon, 19 Jan 2026 11:23:35 +0530 [thread overview]
Message-ID: <20260119055335.1006446-3-kasturi.shekar@siemens.com> (raw)
In-Reply-To: <20260119055335.1006446-1-kasturi.shekar@siemens.com>
Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
---
.../files/usr/bin/installer_ui.sh | 86 +++++++++++++++++++
1 file changed, 86 insertions(+)
create mode 100755 meta-isar/recipes-installer/deploy-image/files/usr/bin/installer_ui.sh
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
new file mode 100755
index 00000000..33685c6f
--- /dev/null
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/installer_ui.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+#
+# installer_ui.sh — Attended installer frontend
+# ------------------------------------------------
+
+SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
+INSTALL_DATA=${INSTALL_DATA:-./install}
+
+# Backend APIs
+. "$SCRIPT_DIR/sys_api.sh"
+
+# ------------------------------------------------
+# Helpers
+# ------------------------------------------------
+die() {
+ dialog --msgbox "$1" 6 60
+ exit 1
+}
+
+# ------------------------------------------------
+# UI: Select image
+# ------------------------------------------------
+ui_select_image() {
+ local images json list=()
+
+ # On failure, show error dialog and exit
+ json=$(sys_locate_disk_images search_path="$INSTALL_DATA") || \
+ die "No installable images found in $INSTALL_DATA"
+
+ # Extract image paths from JSON
+ images=$(echo "$json" | sed -n 's/.*"images":\[\(.*\)\].*/\1/p' | tr -d '"' | tr ',' '\n')
+
+ # Building dialog menu entries
+ for img in $images; do
+ base=$(basename "$img")
+ list+=("$img" "$base")
+ done
+
+ # Display menu and capture selection
+ INSTALL_IMAGE=$(dialog --no-tags \
+ --menu "Select image to install" 10 70 5 \
+ "${list[@]}" \
+ --output-fd 1) || exit 0
+}
+
+# ------------------------------------------------
+# UI: Select target device
+# ------------------------------------------------
+ui_select_target_device() {
+ local list=()
+
+ devices=$(sys_list_valid_target_devices) || \
+ die "No valid target devices found"
+
+ for dev in $devices; do
+ [ -b "$dev" ] || continue
+
+ size=$(lsblk --nodeps --noheadings -o SIZE "$dev" 2>/dev/null | tr -d " ")
+ [ -z "$size" ] && size="unknown"
+
+ if cmp /dev/zero "$dev" -n 1M >/dev/null 2>&1; then
+ state="empty"
+ else
+ state="contains data"
+ fi
+
+ list+=("$dev" "$dev ($size, $state)")
+ done
+
+ if [ "${#list[@]}" -lt 2 ]; then
+ die "no installable target devices available"
+ fi
+
+ TARGET_DEVICE=$(dialog --no-tags \
+ --menu "Select target device" 10 70 6 \
+ "${list[@]}" \
+ --output-fd 1) || exit 0
+}
+
+run_interactive_installer() {
+ clear
+ ui_select_image
+ ui_select_target_device
+}
+
+run_interactive_installer
--
2.39.5
--
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 visit https://groups.google.com/d/msgid/isar-users/20260119055335.1006446-3-kasturi.shekar%40siemens.com.
prev parent reply other threads:[~2026-01-19 5:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-19 5:53 [PATCH v1 0/2] installer: split backend APIs from frontend UI 'Kasturi Shekar' via isar-users
2026-01-19 5:53 ` [PATCH v1 1/2] installer: introduce sys_api.sh backend interface 'Kasturi Shekar' via isar-users
2026-01-19 5:53 ` 'Kasturi Shekar' via isar-users [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260119055335.1006446-3-kasturi.shekar@siemens.com \
--to=isar-users@googlegroups.com \
--cc=kasturi.shekar@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox