From: "srinuvasan.a via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: cedric.hombourger@siemens.com, Srinuvasan A <srinuvasan.a@siemens.com>
Subject: [PATCH 2/3] deploy-image: report the result of the console holding the lock
Date: Tue, 27 Oct 2026 16:36:00 +0530 [thread overview]
Message-ID: <20261027110601.1197504-2-srinuvasan.a@siemens.com> (raw)
In-Reply-To: <20261027110601.1197504-1-srinuvasan.a@siemens.com>
From: Srinuvasan A <srinuvasan.a@siemens.com>
When several installer consoles run, only the one holding the
installation lock copies the image. Consoles that do not get the lock
waited for it to finish and then always reported success, even if the
installation had failed.
Wait for the lock holder with flock and let it record its outcome in
/run/installer.result. Consoles that waited return success only if the
holder succeeded.
Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
Suggested-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
.../deploy-image/files/usr/bin/sys_api.sh | 27 +++++++++----------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/sys_api.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/sys_api.sh
index 5f591745..26b39108 100644
--- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/sys_api.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/sys_api.sh
@@ -278,7 +278,9 @@ sys_bmap_options_for_image() {
#
# Performs the actual bmaptool copy, serializing concurrent installer
# consoles via flock. When UI hook functions are available, this API
-# uses them to present a progress gauge in attended mode.
+# uses them to present a progress gauge in attended mode. Consoles that
+# do not get the lock wait for its holder and report its result, which is
+# kept in /run/installer.result.
#
# Optional UI hooks (if defined):
# ui_start_progress_gauge <pipe_path>
@@ -289,6 +291,7 @@ sys_install_image_with_lock() {
local target_device="$2"
local lockfile="/run/installer.lock"
local progress_pipe="/run/installer.fifo"
+ local result_file="/run/installer.result"
local bmap_options
local bmap_version
local quiet_flag=""
@@ -297,6 +300,7 @@ sys_install_image_with_lock() {
exec 9>"$lockfile"
if flock -n 9; then
+ rm -f "$result_file"
bmap_version=$(bmaptool --version | awk '{ print $NF }')
if sys_version_ge "$bmap_version" "3.6"; then
@@ -323,27 +327,20 @@ sys_install_image_with_lock() {
if declare -F ui_stop_progress_gauge >/dev/null; then
ui_stop_progress_gauge
fi
+ echo failed > "$result_file"
return 1
fi
if declare -F ui_stop_progress_gauge >/dev/null; then
ui_stop_progress_gauge
fi
- else
- echo "Installation already running in another console."
- sleep 5
- if [ -e "$progress_pipe" ]; then
- echo "Installation progress..."
- tail -f "$progress_pipe" | while read -r line; do
- printf "\r%s%%" "$line"
- done
- else
- echo "Waiting for installation to finish..."
- while pgrep -x "bmaptool" >/dev/null; do
- sleep 5
- done
- fi
+ echo ok > "$result_file"
+ else
+ echo "Installation already running in another console. Waiting for it to finish..."
+ flock 9
+ # The other console owns the result; only report success if it did.
+ [ "$(cat "$result_file" 2>/dev/null)" = ok ] || return 1
fi
return 0
--
2.34.1
--
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/20261027110601.1197504-2-srinuvasan.a%40siemens.com.
next prev parent reply other threads:[~2026-10-27 11:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 11:05 [PATCH 1/3] installer: add reusable progress gauge srinuvasan.a via isar-users
2026-10-27 11:06 ` srinuvasan.a via isar-users [this message]
2026-10-27 11:06 ` [PATCH 3/3] deploy-image: re-encrypt LUKS volumes with new master keys srinuvasan.a via isar-users
2026-10-30 16:16 ` [PATCH 1/3] installer: add reusable progress gauge Zhihang Wei
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=20261027110601.1197504-2-srinuvasan.a@siemens.com \
--to=isar-users@googlegroups.com \
--cc=cedric.hombourger@siemens.com \
--cc=srinuvasan.a@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