public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v3 4/4] installer: Run unattended mode on the only terminal
Date: Tue, 18 Mar 2025 17:02:17 +0300	[thread overview]
Message-ID: <20250318140622.13676-5-ubely@ilbers.de> (raw)
In-Reply-To: <20250318140622.13676-1-ubely@ilbers.de>

This fixes race between two unattended installer instances running
on different (e.g. serial "ttyS0" and graphic "tty1") terminals.

While one of them starts writing the disk, another one fails
and schedules reboot in 60 seconds. Depending on build machine
performance we can get incomplete installation and broken target
filesystem.

Selected terminal with unattended installer can be set by
INSTALLER_UNATTENDED_TTY variable. It should correspond to one
of INSTALLER_GETTY_TARGETS from deploy-image.service recipe.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 .../recipes-installer/deploy-image/deploy-image_0.1.bb    | 8 +++++++-
 .../bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 rename meta-isar/recipes-installer/deploy-image/files/usr/bin/{deploy-image-wic.sh => deploy-image-wic.sh.tmpl} (95%)

diff --git a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
index 242ca88e..1af3a6dd 100644
--- a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
+++ b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
@@ -7,10 +7,16 @@ DESCRIPTION = "Install image to device"
 
 inherit dpkg-raw
 
-SRC_URI = "file://usr/bin/deploy-image-wic.sh \
+SRC_URI = "file://usr/bin/deploy-image-wic.sh.tmpl \
            file://usr/lib/deploy-image-wic/handle-config.sh \
           "
 DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
+
+INSTALLER_UNATTENDED_TTY ?= "${MACHINE_SERIAL}"
+
+TEMPLATE_FILES += "usr/bin/deploy-image-wic.sh.tmpl"
+TEMPLATE_VARS += "INSTALLER_UNATTENDED_TTY"
+
 do_install[cleandirs] = "${D}/usr/bin/ \
                          ${D}/usr/lib/deploy-image-wic \
                         "
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.tmpl
similarity index 95%
rename from meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
rename to meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh.tmpl
index 7f552eee..33a409f3 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.tmpl
@@ -10,6 +10,12 @@ SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; )
 
 . ${SCRIPT_DIR}/../lib/deploy-image-wic/handle-config.sh
 
+if $installer_unattended; then
+    if [ "$(tty)" != "/dev/${INSTALLER_UNATTENDED_TTY}" ]; then
+        dialog --msgbox "Unattended installer is active on ${INSTALLER_UNATTENDED_TTY}. Please wait for it to finish." 7 60
+        installer_unattended=false
+    fi
+fi
 
 if ! $installer_unattended; then
     installer_image_uri=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;)
-- 
2.45.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/20250318140622.13676-5-ubely%40ilbers.de.

  parent reply	other threads:[~2025-03-18 14:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 14:02 [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely
2025-03-18 14:02 ` [PATCH v3 1/4] meta-isar: Use to_boolean for INSTALLER_UNATTENDED variable Uladzimir Bely
2025-03-18 14:02 ` [PATCH v3 2/4] testsuite: Disable "snapshot" feature for installer image Uladzimir Bely
2025-03-18 14:02 ` [PATCH v3 3/4] Installer: allow to set custom TTYs for installer Uladzimir Bely
2025-03-18 21:25   ` 'Jan Kiszka' via isar-users
2025-03-18 14:02 ` Uladzimir Bely [this message]
2025-03-18 21:39   ` [PATCH v3 4/4] installer: Run unattended mode on the only terminal 'Jan Kiszka' via isar-users
2025-03-19  9:15     ` Uladzimir Bely
2025-03-19 10:13     ` Uladzimir Bely
2025-03-24  9:20 ` [PATCH v3 0/4] Fixes for unattended installation Uladzimir Bely

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=20250318140622.13676-5-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.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