diff options
| author | Mathieu Othacehe <othacehe@gnu.org> | 2022-08-16 10:51:43 +0200 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2022-10-13 10:48:08 +0200 |
| commit | 91d817cc17fad5bfcba6ea3406b1275e8695f658 (patch) | |
| tree | f86cafc226bb9497639ca5adc795c69bcfafca7d /gnu/installer | |
| parent | 2c11e857afc4f231183ac7769ca053fd637f005e (diff) | |
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>
Diffstat (limited to 'gnu/installer')
| -rw-r--r-- | gnu/installer/newt/partition.scm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm index 2adb4922b41..86607a8380b 100644 --- a/gnu/installer/newt/partition.scm +++ b/gnu/installer/newt/partition.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2018, 2019 Mathieu Othacehe <m.othacehe@gmail.com> | 2 | ;;; Copyright © 2018, 2019, 2022 Mathieu Othacehe <m.othacehe@gmail.com> |
| 3 | ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org> | 3 | ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> | 4 | ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
| 5 | ;;; | 5 | ;;; |
| @@ -92,6 +92,18 @@ disk. The installation device as well as the small devices are filtered.") | |||
| 92 | (device (car result))) | 92 | (device (car result))) |
| 93 | device)) | 93 | device)) |
| 94 | 94 | ||
| 95 | (define (run-label-confirmation-page callback) | ||
| 96 | (lambda (item) | ||
| 97 | (match (current-clients) | ||
| 98 | (() | ||
| 99 | (and (run-confirmation-page | ||
| 100 | (format #f (G_ "This will create a new ~a partition table, \ | ||
| 101 | all data on disk will be lost, are you sure you want to proceed?") item) | ||
| 102 | (G_ "Format disk?") | ||
| 103 | #:exit-button-procedure callback) | ||
| 104 | item)) | ||
| 105 | (_ item)))) | ||
| 106 | |||
| 95 | (define (run-label-page button-text button-callback) | 107 | (define (run-label-page button-text button-callback) |
| 96 | "Run a page asking the user to select a partition table label." | 108 | "Run a page asking the user to select a partition table label." |
| 97 | ;; Force the GPT label if UEFI is supported. | 109 | ;; Force the GPT label if UEFI is supported. |
| @@ -103,6 +115,8 @@ Be careful, all data on the disk will be lost.") | |||
| 103 | #:title (G_ "Partition table") | 115 | #:title (G_ "Partition table") |
| 104 | #:listbox-items '("msdos" "gpt") | 116 | #:listbox-items '("msdos" "gpt") |
| 105 | #:listbox-item->text identity | 117 | #:listbox-item->text identity |
| 118 | #:listbox-callback-procedure | ||
| 119 | (run-label-confirmation-page button-callback) | ||
| 106 | #:button-text button-text | 120 | #:button-text button-text |
| 107 | #:button-callback-procedure button-callback))) | 121 | #:button-callback-procedure button-callback))) |
| 108 | 122 | ||
