public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Subject: [PATCH 09/17] meta-isar: deploy-image: Allow to cancel installation
Date: Tue,  2 Jul 2024 15:38:23 +0200	[thread overview]
Message-ID: <baf4b2a434e0452d88798c84c66353d527e47925.1719927511.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1719927511.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

Terminate if the users chooses to cancel. Offer this option also on the
final message box before the start.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../deploy-image/files/deploy-image-wic.sh    | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
index 284252fb..09d6cc11 100644
--- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh
@@ -12,10 +12,12 @@ if [ -z "$DISK_IMAGE" ]; then
     shopt -s nullglob
     array=(*)
     shopt -u nullglob
-    DISK_IMAGE=$(dialog --no-tags \
-                 --menu "Select image to be installed" 10 60 3 \
-                 "${array[@]}" --output-fd 1)
     popd
+    if ! DISK_IMAGE=$(dialog --no-tags \
+                      --menu "Select image to be installed" 10 60 3 \
+                      "${array[@]}" --output-fd 1)
+        exit 0
+    fi
 fi
 if [ ! -f "$installdata/$DISK_IMAGE" ]; then
     dialog --msgbox "Could not find an image to install. Installation aborted." 7 60
@@ -80,15 +82,19 @@ if [ "$(echo "$target_device_list" | wc -w)" -gt 1 ]; then
         target_size=$(lsblk --nodeps --noheadings -o SIZE /dev/"$target")
         array+=("/dev/$target" "/dev/$target $target_size")
     done
-    TARGET_DEVICE=$(dialog --no-tags \
-                    --menu "Select device to install $DISK_IMAGE" 10 60 3 \
-                    "${array[@]}" --output-fd 1)
-
+    if ! TARGET_DEVICE=$(dialog --no-tags \
+                         --menu "Select device to install image to" 10 60 3 \
+                         "${array[@]}" --output-fd 1); then
+        exit 0
+    fi
 else
     TARGET_DEVICE=/dev/$(echo "$target_device_list" | tr -d " ")
 fi
 TARGET_DEVICE_SIZE=$(lsblk --nodeps --noheadings -o SIZE "$TARGET_DEVICE")
-dialog --msgbox "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'(Size: '$TARGET_DEVICE_SIZE' )." 7 60
+if ! dialog --yes-label Ok --no-label Cancel \
+            --yesno "Start installing '$DISK_IMAGE' to '$TARGET_DEVICE'(Size: '$TARGET_DEVICE_SIZE' )." 7 60; then
+    exit 0
+fi
 
 bmap_options=""
 if [ -z "$DISK_BMAP" ]; then
-- 
2.43.0


  parent reply	other threads:[~2024-07-02 13:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02 13:38 [PATCH 00/17] Reworks, fixes and unattended mode for image installer Jan Kiszka
2024-07-02 13:38 ` [PATCH 01/17] Kconfig: Rework installer image submenu Jan Kiszka
2024-07-02 13:38 ` [PATCH 02/17] installer: Do not show systemd boot menu Jan Kiszka
2024-07-02 13:38 ` [PATCH 03/17] meta-isar: deploy-image: Change reboot logic Jan Kiszka
2025-03-13 13:10   ` Uladzimir Bely
2025-03-14  5:54     ` 'Jan Kiszka' via isar-users
2025-03-14  6:25       ` Uladzimir Bely
2025-03-14 14:25         ` 'Heinisch, Alexander' via isar-users
2025-03-14 15:04           ` Uladzimir Bely
2024-07-02 13:38 ` [PATCH 04/17] meta-isar: deploy-image: Drop umount attempt after installation Jan Kiszka
2024-07-02 13:38 ` [PATCH 05/17] meta-isar: deploy-image: Fix bmap support Jan Kiszka
2024-07-02 13:38 ` [PATCH 06/17] meta-isar: deploy-image: Improve root mountpoint discovery Jan Kiszka
2024-07-02 13:38 ` [PATCH 07/17] meta-isar: deploy-image: Make TARGET_DEVICE a complete path Jan Kiszka
2024-07-02 13:38 ` [PATCH 08/17] meta-isar: deploy-image: Drop pointless --clear options from dialog Jan Kiszka
2024-07-02 13:38 ` Jan Kiszka [this message]
2024-07-02 13:38 ` [PATCH 10/17] meta-isar: deploy-image: Warn if overwriting a non-empty disk Jan Kiszka
2024-07-03 15:53   ` 'MOESSBAUER, Felix' via isar-users
2024-07-03 15:55     ` 'Jan Kiszka' via isar-users
2024-07-19  5:33       ` Uladzimir Bely
2024-07-19  5:44         ` 'Jan Kiszka' via isar-users
2024-07-02 13:38 ` [PATCH 11/17] meta-isar: deploy-image: Fix and enhance image selection dialog Jan Kiszka
2024-07-02 13:38 ` [PATCH 12/17] meta-isar: deploy-image: Improve target device list dialog Jan Kiszka
2024-07-02 13:38 ` [PATCH 13/17] meta-isar: deploy-image: Polish some dialogs Jan Kiszka
2024-07-02 13:38 ` [PATCH 14/17] meta-isar: deploy-image: Re-indent Jan Kiszka
2024-07-02 13:38 ` [PATCH 15/17] meta-isar: deploy-image: Prepare for auto-installation mode Jan Kiszka
2024-07-02 13:38 ` [PATCH 16/17] meta-isar: deploy-image: Introduce " Jan Kiszka
2024-07-03 15:56   ` 'MOESSBAUER, Felix' via isar-users
2024-07-03 16:08     ` 'Jan Kiszka' via isar-users
2024-07-02 13:38 ` [PATCH 17/17] meta-isar: deploy-image: Polish recipe Jan Kiszka
2024-07-23  7:40 ` [PATCH 00/17] Reworks, fixes and unattended mode for image installer Uladzimir Bely

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=baf4b2a434e0452d88798c84c66353d527e47925.1719927511.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=quirin.gylstorff@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