From patchwork Mon Mar 10 04:12:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kasturi Shekar X-Patchwork-Id: 4083 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Mon, 10 Mar 2025 05:13:29 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-io1-f57.google.com (mail-io1-f57.google.com [209.85.166.57]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 52A4DRHR007656 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 10 Mar 2025 05:13:28 +0100 Received: by mail-io1-f57.google.com with SMTP id ca18e2360f4ac-85b30c95536sf159717739f.1 for ; Sun, 09 Mar 2025 21:13:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1741580002; cv=pass; d=google.com; s=arc-20240605; b=UD8nuiefPNdbeUqsmtG6EZFHMWZ8QbQvAOB0nhIgnleE5EfvjMGoo2hPWXBDv3YHO5 xNKdi77LPUx8vV5YfH5fRQnef1FdzUn8O/a62/0/WWm9NOBpDr1Yl1j7Oko/UgrEp4in XaX4JReHY/QN6lVLgqLFR1b59TdNrvyzaOmBHFb5Ne9vkBcEp98vaPJ8BzMGGGFsTx4T vu/3zih90rm4EqQy6BNGBpgSaR6Iw+h52yo5oGxgz2EugFwJ4sFkMNgLoeiqMqOsM6jw xoJZlFnomZvjQoO6la7mGaMZMKd37Q2//LU3Gn9vEjpiAQcaq1qopSL8id/qsJC3i9l3 NbjQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=D0FQLLV7HOzf6NfrRWkxuqSi+N/v3mqDjGGTs9w0a/I=; fh=QxSvpg4VEIZN9ZRi7IxYysHqCAj/jQOBk2sxAL0UpUo=; b=Xs9uDSZWH8JFmEtVMp4xdTP7Yfn9qWnnucKnonAE5eYew9tRJO9b0e5X4MTST1zyJ7 zXPxSREPLenW+str6ZWhyG4Rlw+jiL6w89SBXrnssQpzg/Tsd80gkEyMFhjOkDiCssPH l1xMFcsILGfwSnpO9wW5oH/Kj5V4UYklOwIOLMl7MStP+MMmxvxLMj+wmsSF4aJoLv9E X+lS1uZcIrrEr2bIF+XenncLQfNxLHrYXx4SwpFvrEJ5g8fNp77wGmKH2AllEQS7S5r6 LE319Kko2OUHFDQHF7ay7e8NMaJMg6/9XW+LBLd23f0psDuMfK+mrajiv5BKZmI1fgcE mTDQ==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=hfG2nd9a; spf=pass (google.com: domain of fm-1328757-202503100413155180d2e9b39038fc00-lgu78y@rts-flowmailer.siemens.com designates 185.136.65.228 as permitted sender) smtp.mailfrom=fm-1328757-202503100413155180d2e9b39038fc00-LgU78Y@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1741580002; x=1742184802; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=D0FQLLV7HOzf6NfrRWkxuqSi+N/v3mqDjGGTs9w0a/I=; b=TB6Y2qSguxqAdhGt3eKL6R6+6rRBzf/ma+v2ORRign8MZ6L5UiwMaoFXir0+I9v0Qf VEFzRG5wVkLEeqI3FNSs80y1C+ZVOawXXNGYMJZ5WxSN3tSiYHCyDJCttXMed8fU2+C5 fdl+3HzpU3ksQv3glMjFi6i+Yw0kMAuHHZ0vqLSxUjKK3ZuYnAW5U0QAyNszaIGUSQTY fEbuqVzSUx2ByWVXw9G1FlRYoW1mGrbfxvDGfWmh/jhBlOXGnbaDK4LTrXqI67vZ1IqJ OTQduujmHDjiqZrgidLs/HNw8tqSnrLkFCyK09IfYUHCk45F8rnfmhnLyGqm/wi2eGLO tGzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741580002; x=1742184802; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=D0FQLLV7HOzf6NfrRWkxuqSi+N/v3mqDjGGTs9w0a/I=; b=YihENF/HurORZIYzgfq0V0S9udcXitzgaUyZX6W39Ob3q9ROI67gS84dLNaAMWta3B vKpyQ8ze8HL6pUW8QIiYX4fYvj96rf5qOc9L2yIiE97pyoBGADsD0Fg6VPiXVbj95OkV 2VFU0O5Xx/v54L669yYTLfUh/RfZMVNGA1bU+aWv7ooI4fxnz+UtXkwJecoGIhzpJ1LQ JseyzqVM8q2zRzsZpaBT83AeJgz2vHRD1Wc8gu78RwhsqQmNUx2D4TkA32jUWHmrBGdA n5EIfZCQRHgrnIuQiVxGTwwfCkLDInTxkCvTMLoei2lfNjK9w4IV3spZd4ox3YcuwqdR s3Zg== X-Forwarded-Encrypted: i=2; AJvYcCVkEAhlmsDPC3KlPzjgWO0Pn4SaE4BkdGbFr5mozyjfwCc7FWV0+M/BL8C7jz8cSnmiGD/T8Ew=@isar-build.org X-Gm-Message-State: AOJu0Yy7oPsKwdYghyajrIrUob0uFNmE5dn3NDMfDAcALbiQHbuVVLCz 8DmJKT0XescQdHQ2ZAdNy8Dw6s2yfUaOsUvb/sM7mA1zAtmOygbU X-Google-Smtp-Source: AGHT+IFnbJi1TSEZHeJUoPyulGtlQ2kVumoIS29fCpmaoDTincssVAleVaYyUc5dl24UzGUn2D4JUw== X-Received: by 2002:a05:6e02:174b:b0:3d4:2a4e:1272 with SMTP id e9e14a558f8ab-3d441a46c62mr146183105ab.19.1741580002014; Sun, 09 Mar 2025 21:13:22 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com; h=Adn5yVHsUua5aB9pKWO2lbXShVDwB61/aViE0RP3SvXYl5J5mQ== Received: by 2002:a05:6e02:60d:b0:3d2:abdb:b6ea with SMTP id e9e14a558f8ab-3d43688e157ls19014715ab.0.-pod-prod-07-us; Sun, 09 Mar 2025 21:13:20 -0700 (PDT) X-Received: by 2002:a05:6602:3a02:b0:85b:3fda:7dbf with SMTP id ca18e2360f4ac-85b3fda80b2mr676078039f.9.1741580000734; Sun, 09 Mar 2025 21:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741580000; cv=none; d=google.com; s=arc-20240605; b=BXm3clMKfqkX6guZF4QRTAzsBjpQnvZZ/VsdgAUuV78oUrPsvZrb8yWPT0uIkUXC3M Jv3LDkeGowv/4y2MIqKTd3b2GTRTwrRnr3ulEoC2J1SWqfa2y8HykE8tjg9IzJ2OW49W +r7wMdByYXHMABPR81vdlddglM7SVw8NPfIqQjyCodU0dlOcN+z6TOqhxXVo2+Tohzvv 6mHpGb6b7m7WBx8BVS0PyfPxXhi+mE+AqwdBrs/vWTf8gddKjofHwTdW8Uf33hWu7GPb k/HLSaoAVt60xnvXNNYaEnKagoQtILtJrz53Ux3a5GsgCIq//GFEIzJgqtMzkzBgOR3T yOOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=HhuEsXhKaIV6pH1OO3ghAofwNROYxcfJ/KU6rrEzhBc=; fh=pR4tJPO4NbHlIB/rP4bIo54Z1zh5hd/ksAGQ0tcKkYM=; b=AVC3dqe3ManbgcDugMgaOeENNEGWKNIjUx7gdmddYgU8MG5wFcisYEQIk/FnZiQfXc +iw7mrk4KAMFvVg0JiGuspXeutXU+YR94ADO01Fwz1kDh4OpsPHyZedR2NNNyXA710Y3 YabDeY3IX52e34bA1Jl8gi3ZllKes0/xcVS3p1TWBedRVEqwchcxb2TFsOSfVOxurZVw Iiw8I5ag7uGLL1cJByavYXTiNg3c34IyNFSbvoVqYiALufHsxjNz/Pt34sWpyAUYbhhG D8YR3gwE6vGAcqQJuJB30uFK4LYnBhlIhmPH9Yalwend1iF+LK0XVJGc4YGU72fRF/KO jPOQ==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=hfG2nd9a; spf=pass (google.com: domain of fm-1328757-202503100413155180d2e9b39038fc00-lgu78y@rts-flowmailer.siemens.com designates 185.136.65.228 as permitted sender) smtp.mailfrom=fm-1328757-202503100413155180d2e9b39038fc00-LgU78Y@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-65-228.siemens.flowmailer.net (mta-65-228.siemens.flowmailer.net. [185.136.65.228]) by gmr-mx.google.com with ESMTPS id 8926c6da1cb9f-4f218db4ad1si274231173.2.2025.03.09.21.13.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Mar 2025 21:13:20 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-1328757-202503100413155180d2e9b39038fc00-lgu78y@rts-flowmailer.siemens.com designates 185.136.65.228 as permitted sender) client-ip=185.136.65.228; Received: by mta-65-228.siemens.flowmailer.net with ESMTPSA id 202503100413155180d2e9b39038fc00 for ; Mon, 10 Mar 2025 05:13:15 +0100 X-Patchwork-Original-From: "'Kasturi Shekar' via isar-users" From: Kasturi Shekar To: isar-users@googlegroups.com Cc: Kasturi Shekar Subject: [PATCH v2] isar-installer: show progress bar during bmaptool copy process Date: Mon, 10 Mar 2025 09:42:48 +0530 Message-Id: <20250310041248.270945-1-kasturi.shekar@siemens.com> In-Reply-To: <745c6vzEAAAJ> References: <745c6vzEAAAJ> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1328757:519-21489:flowmailer X-Original-Sender: kasturi.shekar@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=hfG2nd9a; spf=pass (google.com: domain of fm-1328757-202503100413155180d2e9b39038fc00-lgu78y@rts-flowmailer.siemens.com designates 185.136.65.228 as permitted sender) smtp.mailfrom=fm-1328757-202503100413155180d2e9b39038fc00-LgU78Y@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Kasturi Shekar Reply-To: Kasturi Shekar Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= - 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 --- .../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