From 55c43108ac763c68f95cce3d32c60b8944b771f5 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sat, 8 Jun 2019 05:04:36 +0200 Subject: installer: Show, don't Hide. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/installer/newt/user.scm (run-user-add-page): Change the input visibility checkbox's text to ‘Show’, and default to unchecked. * gnu/installer/newt/page.scm (run-input-page): Likewise. Rename INPUT-HIDE-CHECKBOX? argument to INPUT-VISIBILITY-CHECKBOX?. --- gnu/installer/newt/page.scm | 9 +++++---- gnu/installer/newt/user.scm | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'gnu/installer') diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm index 728721c08f..630efde9cc 100644 --- a/gnu/installer/newt/page.scm +++ b/gnu/installer/newt/page.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Mathieu Othacehe ;;; Copyright © 2019 Ludovic Courtès +;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -75,7 +76,7 @@ this page to TITLE." #:key (allow-empty-input? #f) (default-text #f) - (input-hide-checkbox? #f) + (input-visibility-checkbox? #f) (input-field-width 40) (input-flags 0)) "Run a page to prompt user for an input. The given TEXT will be displayed @@ -88,8 +89,8 @@ input box, such as FLAG-PASSWORD." input-field-width #:flags FLAG-BORDER)) (input-visible-cb - (make-checkbox -1 -1 (G_ "Hide") #\x "x ")) - (input-flags* (if input-hide-checkbox? + (make-checkbox -1 -1 (G_ "Show") #\space "x ")) + (input-flags* (if input-visibility-checkbox? (logior FLAG-PASSWORD FLAG-SCROLL input-flags) input-flags)) @@ -102,7 +103,7 @@ input box, such as FLAG-PASSWORD." (apply horizontal-stacked-grid GRID-ELEMENT-COMPONENT input-entry - `(,@(if input-hide-checkbox? + `(,@(if input-visibility-checkbox? (list GRID-ELEMENT-COMPONENT input-visible-cb) '()))) GRID-ELEMENT-COMPONENT ok-button)) diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm index dab805198f..b747886c55 100644 --- a/gnu/installer/newt/user.scm +++ b/gnu/installer/newt/user.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Mathieu Othacehe ;;; Copyright © 2019 Ludovic Courtès +;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -55,7 +56,7 @@ REAL-NAME, and HOME-DIRECTORY as the initial values in the form." (entry-home-directory (make-entry -1 -1 entry-width #:initial-value home-directory)) (password-visible-cb - (make-checkbox -1 -1 (G_ "Hide") #\x "x ")) + (make-checkbox -1 -1 (G_ "Show") #\space "x ")) (entry-password (make-entry -1 -1 entry-width #:flags (logior FLAG-PASSWORD FLAG-SCROLL))) @@ -156,7 +157,7 @@ a thunk, if the confirmation doesn't match PASSWORD, and return its result." (run-input-page (G_ "Please confirm the password.") (G_ "Password confirmation required") #:allow-empty-input? #t - #:input-hide-checkbox? #t)) + #:input-visibility-checkbox? #t)) (if (string=? password confirmation) password @@ -173,7 +174,7 @@ a thunk, if the confirmation doesn't match PASSWORD, and return its result." (run-input-page (G_ "Please choose a password for the system \ administrator (\"root\").") (G_ "System administrator password") - #:input-hide-checkbox? #t)) + #:input-visibility-checkbox? #t)) (confirm-password password run-root-password-page)) -- cgit v1.2.3 From 3c56d030335da3a43fa0ba2ff2f355d7696efbc8 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sat, 8 Jun 2019 15:46:30 +0200 Subject: installer: Hide the Wi-Fi passphrase by default. * gnu/installer/newt/wifi.scm (run-wifi-password-page): Add an #:INPUT-VISIBILITY-CHECKBOX? to the input page. --- gnu/installer/newt/wifi.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnu/installer') diff --git a/gnu/installer/newt/wifi.scm b/gnu/installer/newt/wifi.scm index 1cb2ef2df3..3fd5756b99 100644 --- a/gnu/installer/newt/wifi.scm +++ b/gnu/installer/newt/wifi.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Mathieu Othacehe ;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -88,7 +89,8 @@ nmc_wifi_strength_bars." (define (run-wifi-password-page) "Run a page prompting user for a password and return it." (run-input-page (G_ "Please enter the wifi password.") - (G_ "Password required"))) + (G_ "Password required") + #:input-visibility-checkbox? #t)) (define (run-wrong-password-page service-name) "Run a page to inform user of a wrong password input." -- cgit v1.2.3 From 3dd3ac4d83db0609e10637e9d21d7abb2198398d Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 23 Sep 2019 13:06:36 +0200 Subject: installer: Fix run-input-page calls. This fixes 55c43108 commit that renamed input-hide-checkbox? into input-visibility-checkbox?. * gnu/installer/newt/partition.scm (prompt-luks-passwords): Rename input-hide-checkbox? into input-visibility-checkbox?. --- gnu/installer/newt/partition.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gnu/installer') diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm index cd9d46316a..7a9f11a15e 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 Mathieu Othacehe +;;; Copyright © 2018, 2019 Mathieu Othacehe ;;; Copyright © 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. @@ -159,14 +159,14 @@ USER-PARTITIONS list. Return this list with password fields filled-in." (format #f (G_ "Please enter the password for the \ encryption of partition ~a (label: ~a).") file-name crypt-label) (G_ "Password required") - #:input-hide-checkbox? #t))) + #:input-visibility-checkbox? #t))) (password-confirm-page (lambda () (run-input-page (format #f (G_ "Please confirm the password for the \ encryption of partition ~a (label: ~a).") file-name crypt-label) (G_ "Password confirmation required") - #:input-hide-checkbox? #t)))) + #:input-visibility-checkbox? #t)))) (if crypt-label (let loop () (let ((password (password-page)) -- cgit v1.2.3 From 70c7b7c79920dd6500ba5e4e88fe147cc44923d8 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Tue, 24 Sep 2019 11:56:46 +0200 Subject: installer: Update to Guile-Parted 0.0.2 release. * gnu/installer/parted.scm (data-partition?, metadata-partition?, freespace-partition?, normal-partition?, extended-partition?, logical-partition?): Remove, as now provided by Guile-Parted. * gnu/installer/newt/partition.scm (run-disk-page): Remove disk-destroy calls, replace disk-delete-all by disk-remove-all-partitions and disk-delete-partition by disk-remove-partition*. --- gnu/installer/newt/partition.scm | 9 +++----- gnu/installer/parted.scm | 48 ++++------------------------------------ 2 files changed, 7 insertions(+), 50 deletions(-) (limited to 'gnu/installer') diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm index 7a9f11a15e..74e9473171 100644 --- a/gnu/installer/newt/partition.scm +++ b/gnu/installer/newt/partition.scm @@ -587,7 +587,6 @@ edit it." disks)) (new-user-partitions (remove-user-partition-by-disk user-partitions item))) - (disk-destroy item) `((disks . ,(cons new-disk other-disks)) (user-partitions . ,new-user-partitions))) `((disks . ,disks) @@ -625,7 +624,7 @@ edit it." info-text))) (case result ((1) - (disk-delete-all item) + (disk-remove-all-partitions item) `((disks . ,disks) (user-partitions . ,(remove-user-partition-by-disk user-partitions item)))) @@ -649,7 +648,7 @@ edit it." (let ((new-user-partitions (remove-user-partition-by-partition user-partitions item))) - (disk-delete-partition disk item) + (disk-remove-partition* disk item) `((disks . ,disks) (user-partitions . ,new-user-partitions)))) (else @@ -696,9 +695,7 @@ by pressing the Exit button.~%~%"))) #f)) (check-user-partitions user-partitions)))) (if user-partitions-ok? - (begin - (for-each (cut disk-destroy <>) disks) - user-partitions) + user-partitions (run-disk-page disks user-partitions #:guided? guided?))) (let* ((result-disks (assoc-ref result 'disks)) diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index 682e233d9f..3439f211e2 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -64,13 +64,7 @@ user-partition-parted-object find-esp-partition - data-partition? - metadata-partition? - freespace-partition? small-freespace-partition? - normal-partition? - extended-partition? - logical-partition? esp-partition? boot-partition? default-esp-mount-point @@ -172,24 +166,6 @@ "Find and return the ESP partition among PARTITIONS." (find esp-partition? partitions)) -(define (data-partition? partition) - "Return #t if PARTITION is a partition dedicated to data (by opposition to -freespace, metadata and protected partition types), return #f otherwise." - (let ((type (partition-type partition))) - (not (any (lambda (flag) - (member flag type)) - '(free-space metadata protected))))) - -(define (metadata-partition? partition) - "Return #t if PARTITION is a metadata partition, #f otherwise." - (let ((type (partition-type partition))) - (member 'metadata type))) - -(define (freespace-partition? partition) - "Return #t if PARTITION is a free-space partition, #f otherwise." - (let ((type (partition-type partition))) - (member 'free-space type))) - (define* (small-freespace-partition? device partition #:key (max-size MEBIBYTE-SIZE)) @@ -200,21 +176,6 @@ inferior to MAX-SIZE, #f otherwise." (device-sector-size device)))) (< size max-sector-size))) -(define (normal-partition? partition) - "return #t if partition is a normal partition, #f otherwise." - (let ((type (partition-type partition))) - (member 'normal type))) - -(define (extended-partition? partition) - "return #t if partition is an extended partition, #f otherwise." - (let ((type (partition-type partition))) - (member 'extended type))) - -(define (logical-partition? partition) - "Return #t if PARTITION is a logical partition, #f otherwise." - (let ((type (partition-type partition))) - (member 'logical type))) - (define (partition-user-type partition) "Return the type of PARTITION, to be stored in the TYPE field of record. It can be 'normal, 'extended or 'logical." @@ -813,7 +774,7 @@ cause them to cross." (define (rmpart disk number) "Remove the partition with the given NUMBER on DISK." (let ((partition (disk-get-partition disk number))) - (disk-remove-partition disk partition))) + (disk-remove-partition* disk partition))) ;; @@ -928,12 +889,12 @@ exists." (if has-extended? ;; msdos - remove everything. - (disk-delete-all disk) + (disk-remove-all-partitions disk) ;; gpt - remove everything but esp if it exists. (for-each (lambda (partition) (and (data-partition? partition) - (disk-remove-partition disk partition))) + (disk-remove-partition* disk partition))) non-boot-partitions)) (let* ((start-partition @@ -1348,7 +1309,7 @@ USER-PARTITIONS, or return nothing." (define (init-parted) "Initialize libparted support." - (probe-all-devices) + (probe-all-devices!) (exception-set-handler (lambda (exception) EXCEPTION-OPTION-UNHANDLED))) @@ -1364,7 +1325,6 @@ the devices not to be used before returning." ;; https://mail.gnome.org/archives/commits-list/2013-March/msg18423.html. (let ((device-file-names (map device-path devices))) (for-each force-device-sync devices) - (free-all-devices) (for-each (lambda (file-name) (let ((in-use? (with-delay-device-in-use? file-name))) (and in-use? -- cgit v1.2.3