* [PATCH v2] isar-installer: show progress bar during bmaptool copy process
[not found] <BCpM6yy0AQAJ>
@ 2025-03-10 6:58 ` 'Kasturi Shekar' via isar-users
2025-03-10 7:03 ` [PATCH v3] " 'Kasturi Shekar' via isar-users
1 sibling, 0 replies; 3+ messages in thread
From: 'Kasturi Shekar' via isar-users @ 2025-03-10 6:58 UTC (permalink / raw)
To: isar-users; +Cc: 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.shekar@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
--
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/20250310065855.272829-1-kasturi.shekar%40siemens.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3] isar-installer: show progress bar during bmaptool copy process
[not found] <BCpM6yy0AQAJ>
2025-03-10 6:58 ` [PATCH v2] isar-installer: show progress bar during bmaptool copy process 'Kasturi Shekar' via isar-users
@ 2025-03-10 7:03 ` 'Kasturi Shekar' via isar-users
2025-03-13 13:32 ` Uladzimir Bely
1 sibling, 1 reply; 3+ messages in thread
From: 'Kasturi Shekar' via isar-users @ 2025-03-10 7:03 UTC (permalink / raw)
To: isar-users; +Cc: 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.shekar@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
+ # 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
--
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/20250310070304.272969-1-kasturi.shekar%40siemens.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] isar-installer: show progress bar during bmaptool copy process
2025-03-10 7:03 ` [PATCH v3] " 'Kasturi Shekar' via isar-users
@ 2025-03-13 13:32 ` Uladzimir Bely
0 siblings, 0 replies; 3+ messages in thread
From: Uladzimir Bely @ 2025-03-13 13:32 UTC (permalink / raw)
To: Kasturi Shekar, isar-users
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.shekar@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
> + # 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"
> +
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.
--
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/70005140a8ebc156582f05349d3e8cead21d7bd1.camel%40ilbers.de.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-13 13:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <BCpM6yy0AQAJ>
2025-03-10 6:58 ` [PATCH v2] isar-installer: show progress bar during bmaptool copy process 'Kasturi Shekar' via isar-users
2025-03-10 7:03 ` [PATCH v3] " 'Kasturi Shekar' via isar-users
2025-03-13 13:32 ` Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox