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.
.../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