[PATCH] isar-installer: show progress bar during bmaptool copy process

147 views
Skip to first unread message

Kasturi Shekar

unread,
Mar 7, 2025, 12:26:32 AM3/7/25
to isar-...@googlegroups.com, Kasturi Shekar
- Added support for a progress gauge using a named pipe to capture and display
percentage progress when using `bmaptool`.
- The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
- For `bmaptool` versions below 3.8, the image copy process continues without a
progress bar to maintain compatibility.
- The gauge uses `dialog --gauge` to dynamically update the progress based on
output from the `bmaptool` process.

Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
---
.../files/usr/bin/deploy-image-wic.sh | 44 ++++++++++++++++++-
1 file changed, 42 insertions(+), 2 deletions(-)

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 7f552eee..1265d0cc 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
@@ -149,8 +149,48 @@ if ! $installer_unattended; then
clear
fi

-if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
- exit 1
+# Function to compare version numbers
+version_gt() {
+ if [ "$(printf '%s\n' "$1" "$2" | sort -V | head -n 1)" != "$1" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# Get bmap-tools version using dpkg-query
+bmap_version=$(dpkg-query -W -f='${Version}' bmap-tools | awk -F'[~+-]' '{ print $1 }')
+
+if version_gt "$bmap_version" "3.8" || [ "$bmap_version" = "3.8" ]; then
+ # Create a named pipe for progress communication
+ progress_pipe="/tmp/progress"
+ if ! mkfifo "$progress_pipe"; then
+ echo "Error: Failed to create named pipe $progress_pipe"
+ exit 1
+ fi
+
+ # Initialize the dialog gauge and update it dynamically
+ (
+ while true; do
+ if read -r line < "$progress_pipe"; then
+ percentage=$(echo "$line" | awk '{ print $2 }')
+ echo "$percentage"
+ fi
+ done
+ ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
+
+ # Run bmaptool with psplash for versions greater than or equal to 3.8
+ if ! bmaptool -q copy ${bmap_options} --psplash-pipe="$progress_pipe" "$installer_image_uri" "$installer_target_dev"; then
+ exit 1
+ fi
+
+ # Clean up the named pipe after completion
+ rm "$progress_pipe"
+
+else
+ if ! bmaptool copy ${bmap_options} "$installer_image_uri" "$installer_target_dev"; then
+ exit 1
+ fi
fi

if ! $installer_unattended; then
--
2.39.5

Jan Kiszka

unread,
Mar 7, 2025, 5:41:37 AM3/7/25
to Kasturi Shekar, isar-...@googlegroups.com
On 06.03.25 11:28, 'Kasturi Shekar' via isar-users wrote:
> - Added support for a progress gauge using a named pipe to capture and display
> percentage progress when using `bmaptool`.
> - The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
> as versions prior to 3.8 has some issues with `--psplash-pipe` flag.

Which issues were these? Is there some related upstream or Debian bug?

3.8 means trixie, just to clearify.

> - For `bmaptool` versions below 3.8, the image copy process continues without a
> progress bar to maintain compatibility.
> - The gauge uses `dialog --gauge` to dynamically update the progress based on
> output from the `bmaptool` process.
>
> Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
> ---
> .../files/usr/bin/deploy-image-wic.sh | 44 ++++++++++++++++++-
> 1 file changed, 42 insertions(+), 2 deletions(-)
>
> 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 7f552eee..1265d0cc 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
> @@ -149,8 +149,48 @@ if ! $installer_unattended; then
> clear
> fi
>
> -if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
> - exit 1
> +# Function to compare version numbers
> +version_gt() {
> + if [ "$(printf '%s\n' "$1" "$2" | sort -V | head -n 1)" != "$1" ]; then

This should be possible as well:

version_ge() {
if [ "$(printf '%s\n' "$1"X "$2" | sort -V | head -n 1)" != "$1"X ]; then

> + return 0
> + else
> + return 1
> + fi
> +}
> +
> +# Get bmap-tools version using dpkg-query
> +bmap_version=$(dpkg-query -W -f='${Version}' bmap-tools | awk -F'[~+-]' '{ print $1 }')
> +
> +if version_gt "$bmap_version" "3.8" || [ "$bmap_version" = "3.8" ]; then

... and will obsolete the second test.

> + # Create a named pipe for progress communication
> + progress_pipe="/tmp/progress"
> + if ! mkfifo "$progress_pipe"; then
> + echo "Error: Failed to create named pipe $progress_pipe"
> + exit 1
> + fi
> +
> + # Initialize the dialog gauge and update it dynamically
> + (
> + while true; do
> + if read -r line < "$progress_pipe"; then
> + percentage=$(echo "$line" | awk '{ print $2 }')
> + echo "$percentage"
> + fi
> + done
> + ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
> +
> + # Run bmaptool with psplash for versions greater than or equal to 3.8

The version tests are done above - commenting here is a bit confusing.

> + if ! bmaptool -q copy ${bmap_options} --psplash-pipe="$progress_pipe" "$installer_image_uri" "$installer_target_dev"; then
> + exit 1
> + fi
> +
> + # Clean up the named pipe after completion
> + rm "$progress_pipe"
> +
> +else
> + if ! bmaptool copy ${bmap_options} "$installer_image_uri" "$installer_target_dev"; then
> + exit 1
> + fi
> fi
>
> if ! $installer_unattended; then

Didn't try yet, but I can imagine that it looks nice :)

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center

Kasturi Shekar

unread,
Mar 10, 2025, 12:13:22 AM3/10/25
to isar-...@googlegroups.com, Kasturi Shekar
- Added support for a progress gauge using a named pipe to capture and display
percentage progress when using `bmaptool`.
- The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
- For `bmaptool` versions below 3.8, the image copy process continues without a
progress bar to maintain compatibility.
- The gauge uses `dialog --gauge` to dynamically update the progress based on
output from the `bmaptool` process.

Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
---
.../files/usr/bin/deploy-image-wic.sh | 44 ++++++++++++++++++-
1 file changed, 42 insertions(+), 2 deletions(-)

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 7f552eee..717ec8c9 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
@@ -149,8 +149,48 @@ if ! $installer_unattended; then
clear
fi

-if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
- exit 1
+# Function to compare version numbers
+version_gt() {
+ if [ "$(printf '%s\n' "$1"X "$2" | sort -V | head -n 1)" != "$1"X ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# Get bmap-tools version using dpkg-query
+bmap_version=$(dpkg-query -W -f='${Version}' bmap-tools | awk -F'[~+-]' '{ print $1 }')
+
+if version_gt "$bmap_version" "3.8"; then
+ # Create a named pipe for progress communication
+ progress_pipe="/tmp/progress"
+ if ! mkfifo "$progress_pipe"; then
+ echo "Error: Failed to create named pipe $progress_pipe"
+ exit 1
+ fi
+
+ # Initialize the dialog gauge and update it dynamically
+ (
+ while true; do
+ if read -r line < "$progress_pipe"; then
+ percentage=$(echo "$line" | awk '{ print $2 }')
+ echo "$percentage"
+ fi
+ done
+ ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
+
+ # Run bmaptool with psplash updating progress
+ if ! bmaptool -q copy ${bmap_options} --psplash-pipe="$progress_pipe" "$installer_image_uri" "$installer_target_dev"; then
+ exit 1
+ fi
+
+ # Clean up the named pipe after completion
+ rm "$progress_pipe"
+
+else
+ if ! bmaptool copy ${bmap_options} "$installer_image_uri" "$installer_target_dev"; then
+ exit 1
+ fi
fi

if ! $installer_unattended; then
--
2.39.5

Shekar, Kasturi

unread,
Mar 10, 2025, 1:25:46 AM3/10/25
to Kiszka, Jan, isar-...@googlegroups.com


-----Original Message-----
From: Kiszka, Jan (FT RPD CED) <jan.k...@siemens.com>
Sent: 07 March 2025 16:11
To: Shekar, Kasturi (FT FDS CES LX PBU 2) <kasturi...@siemens.com>; isar-...@googlegroups.com
Subject: Re: [PATCH] isar-installer: show progress bar during bmaptool copy process

On 06.03.25 11:28, 'Kasturi Shekar' via isar-users wrote:
> - Added support for a progress gauge using a named pipe to capture and
> display percentage progress when using `bmaptool`.
> - The progress bar is displayed only when the `bmaptool` version is
> 3.8 or above, as versions prior to 3.8 has some issues with `--psplash-pipe` flag.

Which issues were these? Is there some related upstream or Debian bug?

3.8 means trixie, just to clearify.

Yes, it’s a Debian issue and 3.8 is Trixie.

> - For `bmaptool` versions below 3.8, the image copy process continues
> without a progress bar to maintain compatibility.
> - The gauge uses `dialog --gauge` to dynamically update the progress
> based on output from the `bmaptool` process.
>
> Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
> ---
> .../files/usr/bin/deploy-image-wic.sh | 44 ++++++++++++++++++-
> 1 file changed, 42 insertions(+), 2 deletions(-)
>
> 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 7f552eee..1265d0cc 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-im
> +++ age-wic.sh
> @@ -149,8 +149,48 @@ if ! $installer_unattended; then
> clear
> fi
>
> -if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
> - exit 1
> +# Function to compare version numbers
> +version_gt() {
> + if [ "$(printf '%s\n' "$1" "$2" | sort -V | head -n 1)" != "$1"
> +]; then

This should be possible as well:

version_ge() {
if [ "$(printf '%s\n' "$1"X "$2" | sort -V | head -n 1)" != "$1"X ]; then

> + return 0
> + else
> + return 1
> + fi
> +}
> +
> +# Get bmap-tools version using dpkg-query bmap_version=$(dpkg-query
> +-W -f='${Version}' bmap-tools | awk -F'[~+-]' '{ print $1 }')
> +
> +if version_gt "$bmap_version" "3.8" || [ "$bmap_version" = "3.8" ];
> +then

... and will obsolete the second test.

> + # Create a named pipe for progress communication
> + progress_pipe="/tmp/progress"
> + if ! mkfifo "$progress_pipe"; then
> + echo "Error: Failed to create named pipe $progress_pipe"
> + exit 1
> + fi
> +
> + # Initialize the dialog gauge and update it dynamically
> + (
> + while true; do
> + if read -r line < "$progress_pipe"; then
> + percentage=$(echo "$line" | awk '{ print $2 }')
> + echo "$percentage"
> + fi
> + done
> + ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
> +
> + # Run bmaptool with psplash for versions greater than or equal to
> + 3.8

Shekar, Kasturi

unread,
Mar 10, 2025, 1:40:30 AM3/10/25
to Kiszka, Jan, isar-...@googlegroups.com
-----Original Message-----
From: Kiszka, Jan (FT RPD CED) <jan.k...@siemens.com>
Sent: 07 March 2025 16:11
To: Shekar, Kasturi (FT FDS CES LX PBU 2) <kasturi...@siemens.com>; isar-...@googlegroups.com
Subject: Re: [PATCH] isar-installer: show progress bar during bmaptool copy process

On 06.03.25 11:28, 'Kasturi Shekar' via isar-users wrote:
> - Added support for a progress gauge using a named pipe to capture and
> display percentage progress when using `bmaptool`.
> - The progress bar is displayed only when the `bmaptool` version is
> 3.8 or above, as versions prior to 3.8 has some issues with `--psplash-pipe` flag.

Which issues were these? Is there some related upstream or Debian bug?

3.8 means trixie, just to clearify.

Yes, it’s a Debian issue and 3.8 is Trixie. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034290

Jan Kiszka

unread,
Mar 10, 2025, 2:29:41 AM3/10/25
to Kasturi Shekar, isar-...@googlegroups.com
On 10.03.25 05:12, 'Kasturi Shekar' via isar-users wrote:
> - Added support for a progress gauge using a named pipe to capture and display
> percentage progress when using `bmaptool`.
> - The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
> as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
> - For `bmaptool` versions below 3.8, the image copy process continues without a
> progress bar to maintain compatibility.
> - The gauge uses `dialog --gauge` to dynamically update the progress based on
> output from the `bmaptool` process.
>
> Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
> ---
> .../files/usr/bin/deploy-image-wic.sh | 44 ++++++++++++++++++-
> 1 file changed, 42 insertions(+), 2 deletions(-)
>
> 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 7f552eee..717ec8c9 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
> @@ -149,8 +149,48 @@ if ! $installer_unattended; then
> clear
> fi
>
> -if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
> - exit 1
> +# Function to compare version numbers
> +version_gt() {

You forgot to rename the function.

Jan

Jan Kiszka

unread,
Mar 10, 2025, 2:29:50 AM3/10/25
to Shekar, Kasturi (FT FDS CES LX PBU 2), isar-...@googlegroups.com, Felix Moessbauer
On 10.03.25 06:40, Shekar, Kasturi (FT FDS CES LX PBU 2) wrote:
> -----Original Message-----
> From: Kiszka, Jan (FT RPD CED) <jan.k...@siemens.com>
> Sent: 07 March 2025 16:11
> To: Shekar, Kasturi (FT FDS CES LX PBU 2) <kasturi...@siemens.com>; isar-...@googlegroups.com
> Subject: Re: [PATCH] isar-installer: show progress bar during bmaptool copy process
>
> On 06.03.25 11:28, 'Kasturi Shekar' via isar-users wrote:
>> - Added support for a progress gauge using a named pipe to capture and
>> display percentage progress when using `bmaptool`.
>> - The progress bar is displayed only when the `bmaptool` version is
>> 3.8 or above, as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
>
> Which issues were these? Is there some related upstream or Debian bug?
>
> 3.8 means trixie, just to clearify.
>
> Yes, it’s a Debian issue and 3.8 is Trixie. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034290
>

Kasturi, please fix your email client settings so that you are inserting
proper citation markers ("> "), and your answers become easier
distinguishable.

Felix, did you try to motivate upstream for a stable fix as well?

Kasturi Shekar

unread,
Mar 10, 2025, 2:59:13 AM3/10/25
to isar-...@googlegroups.com, Kasturi Shekar
- Added support for a progress gauge using a named pipe to capture and display
percentage progress when using `bmaptool`.
- The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
- For `bmaptool` versions below 3.8, the image copy process continues without a
progress bar to maintain compatibility.
- The gauge uses `dialog --gauge` to dynamically update the progress based on
output from the `bmaptool` process.

Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
---
.../files/usr/bin/deploy-image-wic.sh | 44 ++++++++++++++++++-
1 file changed, 42 insertions(+), 2 deletions(-)

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 7f552eee..717ec8c9 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
@@ -149,8 +149,48 @@ if ! $installer_unattended; then
clear
fi

-if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
- exit 1
+# Function to compare version numbers
+version_gt() {
2.39.5

Kasturi Shekar

unread,
Mar 10, 2025, 3:03:22 AM3/10/25
to isar-...@googlegroups.com, Kasturi Shekar
- Added support for a progress gauge using a named pipe to capture and display
percentage progress when using `bmaptool`.
- The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
- For `bmaptool` versions below 3.8, the image copy process continues without a
progress bar to maintain compatibility.
- The gauge uses `dialog --gauge` to dynamically update the progress based on
output from the `bmaptool` process.

Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
---
.../files/usr/bin/deploy-image-wic.sh | 44 ++++++++++++++++++-
1 file changed, 42 insertions(+), 2 deletions(-)

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 7f552eee..9743bfe6 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
@@ -149,8 +149,48 @@ if ! $installer_unattended; then
clear
fi

-if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
- exit 1
+# Function to compare version numbers
+version_ge() {
+ if [ "$(printf '%s\n' "$1"X "$2" | sort -V | head -n 1)" != "$1"X ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# Get bmap-tools version using dpkg-query
+bmap_version=$(dpkg-query -W -f='${Version}' bmap-tools | awk -F'[~+-]' '{ print $1 }')
+
+if version_ge "$bmap_version" "3.8"; then

Uladzimir Bely

unread,
Mar 13, 2025, 9:32:43 AM3/13/25
to Kasturi Shekar, isar-...@googlegroups.com
On Mon, 2025-03-10 at 12:33 +0530, 'Kasturi Shekar' via isar-users
wrote:
> - Added support for a progress gauge using a named pipe to capture
> and display
>  percentage progress when using `bmaptool`.
> - The progress bar is displayed only when the `bmaptool` version is
> 3.8 or above,
>  as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
> - For `bmaptool` versions below 3.8, the image copy process continues
> without a
>  progress bar to maintain compatibility.
> - The gauge uses `dialog --gauge` to dynamically update the progress
> based on
>  output from the `bmaptool` process.
>
> Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
> ---
>  .../files/usr/bin/deploy-image-wic.sh         | 44
> ++++++++++++++++++-
>  1 file changed, 42 insertions(+), 2 deletions(-)
>
> 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 7f552eee..9743bfe6 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-
Hello.

Since we are going to reboot anyway, we could not worry about removing
progress_pipe here, move --psplash-pipe="$progress_pipe" into
${bmap_options} and avoid code duplication below.

> +else
> +    if ! bmaptool copy ${bmap_options} "$installer_image_uri"
> "$installer_target_dev"; then
> +        exit 1
> +    fi
>  fi
>  
>  if ! $installer_unattended; then
> --
> 2.39.5
>

--
Best regards,
Uladzimir.



Kasturi Shekar

unread,
Mar 14, 2025, 2:28:43 AM3/14/25
to isar-...@googlegroups.com, Kasturi Shekar
- Added support for a progress gauge using a named pipe to capture and display
percentage progress when using `bmaptool`.
- The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
- For `bmaptool` versions below 3.8, the image copy process continues without a
progress bar to maintain compatibility.
- The gauge uses `dialog --gauge` to dynamically update the progress based on
output from the `bmaptool` process.

Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
---
.../files/usr/bin/deploy-image-wic.sh | 37 ++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)

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 7f552eee..7df9beef 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
@@ -149,7 +149,42 @@ if ! $installer_unattended; then
clear
fi

-if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
+# Function to compare version numbers
+version_ge() {
+ if [ "$(printf '%s\n' "$1"X "$2" | sort -V | head -n 1)" != "$1"X ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# Get bmap-tools version using dpkg-query
+bmap_version=$(dpkg-query -W -f='${Version}' bmap-tools | awk -F'[~+-]' '{ print $1 }')
+
+if version_ge "$bmap_version" "3.8"; then
+ # Create a named pipe for progress communication
+ progress_pipe="/tmp/progress"
+ if ! mkfifo "$progress_pipe"; then
+ echo "Error: Failed to create named pipe $progress_pipe"
+ exit 1
+ fi
+
+ # Add psplash pipe to bmap_options
+ bmap_options="$bmap_options --psplash-pipe=$progress_pipe"
+
+ # Initialize the dialog gauge and update it dynamically
+ (
+ while true; do
+ if read -r line < "$progress_pipe"; then
+ percentage=$(echo "$line" | awk '{ print $2 }')
+ echo "$percentage"
+ fi
+ done
+ ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
+
+fi
+
+if ! bmaptool copy ${bmap_options} "$installer_image_uri" "$installer_target_dev"; then
exit 1
fi

--
2.39.5

Kasturi Shekar

unread,
Mar 17, 2025, 1:49:28 AM3/17/25
to isar-...@googlegroups.com, Kasturi Shekar
- Added support for a progress gauge using a named pipe to capture and display
percentage progress when using `bmaptool`.
- The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
- For `bmaptool` versions below 3.8, the image copy process continues without a
progress bar to maintain compatibility.
- The gauge uses `dialog --gauge` to dynamically update the progress based on
output from the `bmaptool` process.

Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
---
.../files/usr/bin/deploy-image-wic.sh | 38 ++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)

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 7f552eee..85549d57 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
@@ -149,7 +149,43 @@ if ! $installer_unattended; then
+ quiet_flag="-q"
+
+ # Initialize the dialog gauge and update it dynamically
+ (
+ while true; do
+ if read -r line < "$progress_pipe"; then
+ percentage=$(echo "$line" | awk '{ print $2 }')
+ echo "$percentage"
+ fi
+ done
+ ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
+
+fi
+
+if ! bmaptool ${quiet_flag} copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then

Quirin Gylstorff

unread,
Mar 17, 2025, 8:23:04 AM3/17/25
to Kasturi Shekar, isar-...@googlegroups.com
I would not use dpkg - as bmaptool has a `--version` option.

Quirin

Kasturi Shekar

unread,
Mar 18, 2025, 1:20:43 AM3/18/25
to isar-...@googlegroups.com, Kasturi Shekar
- Added support for a progress gauge using a named pipe to capture and display
percentage progress when using `bmaptool`.
- The progress bar is displayed only when the `bmaptool` version is 3.8 or above,
as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
- For `bmaptool` versions below 3.8, the image copy process continues without a
progress bar to maintain compatibility.
- The gauge uses `dialog --gauge` to dynamically update the progress based on
output from the `bmaptool` process.

Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
---
.../files/usr/bin/deploy-image-wic.sh | 38 ++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)

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 7f552eee..66c35506 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
@@ -149,7 +149,43 @@ if ! $installer_unattended; then
clear
fi

-if ! bmaptool copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
+# Function to compare version numbers
+version_ge() {
+ if [ "$(printf '%s\n' "$1"X "$2" | sort -V | head -n 1)" != "$1"X ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# Get bmap-tools version
+bmap_version=$(bmaptool --version | awk '{ print $NF }')
--
2.39.5

Jan Kiszka

unread,
Mar 18, 2025, 2:05:10 AM3/18/25
to Kasturi Shekar, isar-...@googlegroups.com
Please always version our patches, or you will only create confusion for
reviewers and maintainers. This would be "PATCH v5" now.

Jan

Kasturi Shekar

unread,
Mar 19, 2025, 5:43:05 AM3/19/25
to isar-...@googlegroups.com, Kasturi Shekar
2.39.5

Uladzimir Bely

unread,
Mar 27, 2025, 6:32:15 AM3/27/25
to Kasturi Shekar, isar-...@googlegroups.com
On Wed, 2025-03-19 at 15:12 +0530, 'Kasturi Shekar' via isar-users
wrote:
> - Added support for a progress gauge using a named pipe to capture
> and display
>  percentage progress when using `bmaptool`.
> - The progress bar is displayed only when the `bmaptool` version is
> 3.8 or above,
>  as versions prior to 3.8 has some issues with `--psplash-pipe` flag.
> - For `bmaptool` versions below 3.8, the image copy process continues
> without a
>  progress bar to maintain compatibility.
> - The gauge uses `dialog --gauge` to dynamically update the progress
> based on
>  output from the `bmaptool` process.
>
> Signed-off-by: Kasturi Shekar <kasturi...@siemens.com>
> ---
>  .../files/usr/bin/deploy-image-wic.sh         | 38
> ++++++++++++++++++-
>  1 file changed, 37 insertions(+), 1 deletion(-)
>
> 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 7f552eee..66c35506 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
Applied to next, thanks.

--
Best regards,
Uladzimir.
Reply all
Reply to author
Forward
0 new messages