aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2022-08-16 10:51:43 +0200
committerMathieu Othacehe <othacehe@gnu.org>2022-10-13 10:48:08 +0200
commit91d817cc17fad5bfcba6ea3406b1275e8695f658 (patch)
treef86cafc226bb9497639ca5adc795c69bcfafca7d
parent2c11e857afc4f231183ac7769ca053fd637f005e (diff)
downloadguix-91d817cc17fad5bfcba6ea3406b1275e8695f658.tar
guix-91d817cc17fad5bfcba6ea3406b1275e8695f658.tar.gz
installer: partition: Add a confirmation page before formatting.
Fixes: <https://issues.guix.gnu.org/57232>. * gnu/installer/newt/partition.scm (run-label-confirmation-page): New procedure. (run-label-page): Call the above procedure before proceeding. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
-rw-r--r--gnu/installer/newt/partition.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index 2adb4922b4..86607a8380 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2018, 2019, 2022 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
@@ -92,6 +92,18 @@ disk. The installation device as well as the small devices are filtered.")
(device (car result)))
device))
+(define (run-label-confirmation-page callback)
+ (lambda (item)
+ (match (current-clients)
+ (()
+ (and (run-confirmation-page
+ (format #f (G_ "This will create a new ~a partition table, \
+all data on disk will be lost, are you sure you want to proceed?") item)
+ (G_ "Format disk?")
+ #:exit-button-procedure callback)
+ item))
+ (_ item))))
+
(define (run-label-page button-text button-callback)
"Run a page asking the user to select a partition table label."
;; Force the GPT label if UEFI is supported.
@@ -103,6 +115,8 @@ Be careful, all data on the disk will be lost.")
#:title (G_ "Partition table")
#:listbox-items '("msdos" "gpt")
#:listbox-item->text identity
+ #:listbox-callback-procedure
+ (run-label-confirmation-page button-callback)
#:button-text button-text
#:button-callback-procedure button-callback)))