public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] isar-installer: run installer under agetty and reboot via EXIT trap
@ 2025-10-21  4:22 'Kasturi Shekar' via isar-users
  2025-10-21 11:17 ` 'Heinisch, Alexander' via isar-users
  0 siblings, 1 reply; 2+ messages in thread
From: 'Kasturi Shekar' via isar-users @ 2025-10-21  4:22 UTC (permalink / raw)
  To: isar-users; +Cc: Kasturi Shekar

the deploy-image service was directly invoked the installer
script, which could result in the script running without a properly
configured TTY or missing TERM environment variable. This was observed
when bypassing agetty during service startup

now we launch the installer under agetty to ensure that it runs in a
fully initialized terminal environment. Since the service is now managed
by agetty, we ensure that the system reboots once the installation
completes (successfully or not) by adding a trap handler.

Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
---
 .../deploy-image-service/files/install.override.conf |  2 +-
 .../deploy-image/files/usr/bin/deploy-image-wic.sh   | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf b/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf
index 357d8662..913efac5 100644
--- a/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf
+++ b/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf
@@ -1,5 +1,5 @@
 [Service]
 ExecStart=
-ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting in 60 s'; sleep 60); reboot"
+ExecStart=-/sbin/agetty -o --noclear -a root -l /usr/bin/deploy-image-wic.sh --keep-baud 115200,38400,9600 %I $TERM
 StandardInput=tty
 StandardOutput=tty
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..7618a810 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
@@ -3,6 +3,18 @@
 # Copyright (C) Siemens AG, 2024
 #
 # SPDX-License-Identifier: MIT
+trap reboot_on_exit EXIT
+
+reboot_on_exit() {
+    status=$?
+    if [ $status -eq 0 ]; then
+        echo "Installation completed successfully. Rebooting..."
+    else
+        echo "Installation failed. Rebooting in 60 seconds..."
+        sleep 60
+    fi
+    exec reboot
+}
 
 installdata=${INSTALL_DATA:-/install}
 
-- 
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/20251021042201.1184698-1-kasturi.shekar%40siemens.com.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-21 11:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-21  4:22 [PATCH] isar-installer: run installer under agetty and reboot via EXIT trap 'Kasturi Shekar' via isar-users
2025-10-21 11:17 ` 'Heinisch, Alexander' via isar-users

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox