public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Badrikesh Prusty' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: jan.kiszka@siemens.com, Badrikesh Prusty <badrikesh.prusty@siemens.com>
Subject: [PATCH v2 1/3] installer: allow unattended mode to abort with configurable timeout
Date: Sat, 27 Dec 2025 18:15:21 -0500	[thread overview]
Message-ID: <20251227231523.1872055-1-badrikesh.prusty@siemens.com> (raw)

Enable users to abort unattended installations before they start by setting
INSTALLER_UNATTENDED_ABORT_ENABLE. Set an optional countdown timeout with
INSTALLER_UNATTENDED_ABORT_TIMEOUT (default 5 seconds).

Automatically append installer.unattended.abort.enable and
installer.unattended.abort.timeout=<timeout-in-seconds> to the kernel
command line only when the feature is enabled.

Abort unattended mode via keypress and switch to normal installation mode,
notifying all consoles via a shared file /tmp/attended_mode_trigger.

Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
---
 RECIPE-API-CHANGELOG.md                       | 21 +++++++++++++++++++
 .../images/isar-image-installer.bb            |  7 +++++++
 .../files/usr/bin/deploy-image-wic.sh         | 15 +++++++++++++
 .../usr/lib/deploy-image-wic/handle-config.sh | 14 ++++++++++++-
 4 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 3af91541..0bad8a44 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -941,3 +941,24 @@ Example: To bundle multiple target images, set the following in local.conf:
 ```
 INSTALLER_TARGET_IMAGES = "isar-image-base isar-image-debug isar-image-ci"
 ```
+
+### Allow unattended installation to be aborted with configurable timeout
+
+Enable users to abort unattended installations before they start by setting
+`INSTALLER_UNATTENDED_ABORT_ENABLE = 1`. Set the optional countdown timeout
+with `INSTALLER_UNATTENDED_ABORT_TIMEOUT` (default 5 seconds).
+
+Automatically append `installer.unattended.abort.enable` and
+`installer.unattended.abort.timeout=<timeout-in-seconds>` to the kernel
+command line only when the feature is enabled.
+
+Abort unattended mode via keypress and switch to normal installation mode.
+Notify all console instances via a shared file `/tmp/attended_mode_trigger`.
+
+Opt-in: Add the following to local.conf to enable the feature:
+```
+INSTALLER_UNATTENDED_ABORT_ENABLE = "1"
+
+# Optional: set countdown timeout in seconds (default 5)
+INSTALLER_UNATTENDED_ABORT_TIMEOUT = "5"
+```
diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
index 3511f3f6..929939af 100644
--- a/meta-isar/recipes-core/images/isar-image-installer.bb
+++ b/meta-isar/recipes-core/images/isar-image-installer.bb
@@ -21,6 +21,13 @@ ADDITIONAL_KERNEL_CMDLINE:append:unattended-installer = " \
     installer.target.overwrite=${INSTALLER_TARGET_OVERWRITE} \
     "
 
+INSTALLER_UNATTENDED_ABORT_TIMEOUT ??= "5"
+ADDITIONAL_KERNEL_CMDLINE:append:unattended-installer = " \
+    ${@' installer.unattended.abort.enable \
+        installer.unattended.abort.timeout=%s' % d.getVar('INSTALLER_UNATTENDED_ABORT_TIMEOUT') \
+        if d.getVar('INSTALLER_UNATTENDED_ABORT_ENABLE') == '1' else ''} \
+"
+
 IMAGER_INSTALL:wic:append = " ${SYSTEMD_BOOTLOADER_INSTALL}"
 
 IMAGE_INSTALL += "target-bootstrapper-service"
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 9bd47e9f..ca586aa6 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
@@ -10,6 +10,21 @@ SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; )
 
 . "${SCRIPT_DIR}/../lib/deploy-image-wic/handle-config.sh"
 
+if [ "$installer_unattended" = true ] && [ "$installer_unattended_abort_enable" = true ]; then
+    abort_file=/tmp/attended_mode_trigger
+    for ((i=$installer_unattended_abort_timeout; i>0; i--)); do
+        echo -ne "\rUnattended installation will start in $i seconds. Press any key to switch to attended mode..."
+
+	# Switch to attended mode if the abort file exists or any key pressed during countdown
+	# Create abort file to notify all other console instances to abort
+        if [ -f "$abort_file" ] || read -n 1 -t 1; then
+            installer_unattended=false
+            touch "$abort_file"
+            break
+        fi
+    done
+fi
+
 if ! $installer_unattended; then
     installer_image_uri=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
     if [ -z "$installer_image_uri" ] || [ ! -f "$installdata/$installer_image_uri" ]; then
diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh b/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh
index 26b2966e..78c2bc12 100644
--- a/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh
@@ -5,6 +5,8 @@
 # SPDX-License-Identifier: MIT
 
 installer_unattended=false
+installer_unattended_abort_enable=false
+installer_unattended_abort_timeout=5
 installer_image_uri=
 installer_target_dev=
 installer_target_overwrite=
@@ -14,6 +16,8 @@ if [ -f "$installdata/auto.install" ]; then
     read -r installer_image_uri <&3
     read -r installer_target_dev <&3
     read -r installer_target_overwrite <&3
+    read -r installer_unattended_abort_enable <&3
+    read -r installer_unattended_abort_timeout <&3
     exec 3>&-
 
     installer_unattended=true
@@ -22,7 +26,7 @@ fi
 # But let kernel cmdline overrule
 for x in $(cat /proc/cmdline); do
     case $x in
-        installer.unattended*)
+        installer.unattended)
             installer_unattended=true
         ;;
         installer.image.uri=*)
@@ -45,6 +49,12 @@ for x in $(cat /proc/cmdline); do
             installer_target_overwrite="OVERWRITE"
             installer_unattended=true
         ;;
+        installer.unattended.abort.enable)
+            installer_unattended_abort_enable=true
+        ;;
+        installer.unattended.abort.timeout=*)
+            installer_unattended_abort_timeout=${x#installer.unattended.abort.timeout=}
+        ;;
     esac
 done
 
@@ -65,6 +75,8 @@ if ${installer_unattended}; then
     echo "  installer_image_uri=${installer_image_uri}"
     echo "  installer_target_dev=${installer_target_dev}"
     echo "  installer_target_overwrite=${installer_target_overwrite}"
+    echo "  installer_unattended_abort_enable=${installer_unattended_abort_enable}"
+    echo "  installer_unattended_abort_timeout=${installer_unattended_abort_timeout}"
 
     case ${installer_target_overwrite} in
         OVERWRITE|ABORT)
-- 
2.47.3

-- 
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/20251227231523.1872055-1-badrikesh.prusty%40siemens.com.

             reply	other threads:[~2025-12-27 23:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-27 23:15 'Badrikesh Prusty' via isar-users [this message]
2025-12-27 23:15 ` [PATCH v2 2/3] kas: support bundling multiple images via menu system 'Badrikesh Prusty' via isar-users
2025-12-27 23:15 ` [PATCH v2 3/3] kas: add menu option to abort unattended installation 'Badrikesh Prusty' via isar-users

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=20251227231523.1872055-1-badrikesh.prusty@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=badrikesh.prusty@siemens.com \
    --cc=jan.kiszka@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