mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-31 14:56:54 +01:00
installer: Use UUIDs in the 'swap-devices' field.
Note: This change requires an updated 'guix' package that contains Linux-swap support in (gnu build file-systems). * gnu/installer/parted.scm (user-partitions->configuration): Use UUIDs in the 'swap-devices' field. * gnu/installer/newt/final.scm (run-final-page)[wait-for-clients]: New procedure. Use it. * gnu/installer/tests.scm (choose-partitioning): Wait for 'starting-final-step' message and move configuration file dialog handling to... (conclude-installation): ... here. Send over PORT the reply corresponding to 'starting-final-step'. * gnu/tests/install.scm (gui-test-program): When ENCRYPTED? is false, invoke 'swaplabel' in the marionette. (installation-target-os-for-gui-tests): When ENCRYPTED? is false, except a fixed UUID.
This commit is contained in:
parent
81c3dd9cad
commit
1c6d985331
4 changed files with 59 additions and 11 deletions
|
@ -29,6 +29,7 @@ (define-module (gnu installer newt final)
|
||||||
#:use-module (srfi srfi-34)
|
#:use-module (srfi srfi-34)
|
||||||
#:use-module (srfi srfi-35)
|
#:use-module (srfi srfi-35)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module ((ice-9 rdelim) #:select (read-line))
|
||||||
#:use-module (newt)
|
#:use-module (newt)
|
||||||
#:export (run-final-page))
|
#:export (run-final-page))
|
||||||
|
|
||||||
|
@ -107,6 +108,19 @@ (define* (run-install-shell locale
|
||||||
install-ok?))
|
install-ok?))
|
||||||
|
|
||||||
(define (run-final-page result prev-steps)
|
(define (run-final-page result prev-steps)
|
||||||
|
(define (wait-for-clients)
|
||||||
|
(unless (null? (current-clients))
|
||||||
|
(syslog "waiting with clients before starting final step~%")
|
||||||
|
(send-to-clients '(starting-final-step))
|
||||||
|
(match (select (current-clients) '() '())
|
||||||
|
(((port _ ...) _ _)
|
||||||
|
(read-line port)))))
|
||||||
|
|
||||||
|
;; Before generating the configuration file, give clients a chance to do
|
||||||
|
;; things such as changing the swap partition label.
|
||||||
|
(wait-for-clients)
|
||||||
|
|
||||||
|
(syslog "proceeding with final step~%")
|
||||||
(let* ((configuration (format-configuration prev-steps result))
|
(let* ((configuration (format-configuration prev-steps result))
|
||||||
(user-partitions (result-step result 'partition))
|
(user-partitions (result-step result 'partition))
|
||||||
(locale (result-step result 'locale))
|
(locale (result-step result 'locale))
|
||||||
|
|
|
@ -1327,7 +1327,12 @@ (define (user-partitions->configuration user-partitions)
|
||||||
,@(initrd-configuration user-partitions)
|
,@(initrd-configuration user-partitions)
|
||||||
,@(if (null? swap-devices)
|
,@(if (null? swap-devices)
|
||||||
'()
|
'()
|
||||||
`((swap-devices (list ,@swap-devices))))
|
(let* ((uuids (map (lambda (file)
|
||||||
|
(uuid->string (read-partition-uuid file)))
|
||||||
|
swap-devices)))
|
||||||
|
`((swap-devices (list ,@(map (lambda (uuid)
|
||||||
|
`(uuid ,uuid))
|
||||||
|
uuids))))))
|
||||||
,@(if (null? encrypted-partitions)
|
,@(if (null? encrypted-partitions)
|
||||||
'()
|
'()
|
||||||
`((mapped-devices
|
`((mapped-devices
|
||||||
|
|
|
@ -286,8 +286,9 @@ (define* (choose-partitioning port
|
||||||
edit-configuration-file))
|
edit-configuration-file))
|
||||||
"Converse over PORT to choose the partitioning method. When ENCRYPTED? is
|
"Converse over PORT to choose the partitioning method. When ENCRYPTED? is
|
||||||
true, choose full-disk encryption with PASSPHRASE as the LUKS passphrase.
|
true, choose full-disk encryption with PASSPHRASE as the LUKS passphrase.
|
||||||
This conversation goes past the final dialog box that shows the configuration
|
This conversation stops when the user partitions have been formatted, right
|
||||||
file, actually starting the installation process."
|
before the installer generates the configuration file and shows it in a dialog
|
||||||
|
box."
|
||||||
(converse port
|
(converse port
|
||||||
((list-selection (title "Partitioning method")
|
((list-selection (title "Partitioning method")
|
||||||
(multiple-choices? #f)
|
(multiple-choices? #f)
|
||||||
|
@ -330,15 +331,29 @@ (define* (choose-partitioning port
|
||||||
#t)
|
#t)
|
||||||
((info (title "Preparing partitions") _ ...)
|
((info (title "Preparing partitions") _ ...)
|
||||||
(values)) ;nothing to return
|
(values)) ;nothing to return
|
||||||
|
((starting-final-step)
|
||||||
|
;; Do not return anything. The reply will be sent by
|
||||||
|
;; 'conclude-installation' and in the meantime the installer just waits
|
||||||
|
;; for us, giving us a chance to do things such as changing partition
|
||||||
|
;; UUIDs before it generates the configuration file.
|
||||||
|
(values))))
|
||||||
|
|
||||||
|
(define (conclude-installation port)
|
||||||
|
"Conclude the installation by checking over PORT that we get the generated
|
||||||
|
configuration file, accepting it and starting the installation, and then
|
||||||
|
receiving the final messages once the 'guix system init' process has
|
||||||
|
completed."
|
||||||
|
;; Assume the previous message received was 'starting-final-step'; here we
|
||||||
|
;; send the reply to that message, which lets the installer continue.
|
||||||
|
(write #t port)
|
||||||
|
(newline port)
|
||||||
|
(force-output port)
|
||||||
|
|
||||||
|
(converse port
|
||||||
((file-dialog (title "Configuration file")
|
((file-dialog (title "Configuration file")
|
||||||
(text _)
|
(text _)
|
||||||
(file ,configuration-file))
|
(file ,configuration-file))
|
||||||
(edit-configuration-file configuration-file))))
|
(edit-configuration-file configuration-file))
|
||||||
|
|
||||||
(define (conclude-installation port)
|
|
||||||
"Conclude the installation by checking over PORT that we get the final
|
|
||||||
messages once the 'guix system init' process has completed."
|
|
||||||
(converse port
|
|
||||||
((pause) ;"Press Enter to continue."
|
((pause) ;"Press Enter to continue."
|
||||||
#t)
|
#t)
|
||||||
((installation-complete) ;congratulations!
|
((installation-complete) ;congratulations!
|
||||||
|
|
|
@ -1211,6 +1211,16 @@ (define-syntax-rule (marionette-eval* exp marionette)
|
||||||
#$marionette)
|
#$marionette)
|
||||||
(screenshot "installer-run.ppm")
|
(screenshot "installer-run.ppm")
|
||||||
|
|
||||||
|
(unless #$encrypted?
|
||||||
|
;; At this point, user partitions are formatted and the installer is
|
||||||
|
;; waiting for us to start the final step: generating the
|
||||||
|
;; configuration file, etc. Set a fixed UUID on the swap partition
|
||||||
|
;; that matches what 'installation-target-os-for-gui-tests' expects.
|
||||||
|
(marionette-eval* '(invoke #$(file-append util-linux "/sbin/swaplabel")
|
||||||
|
"-U" "11111111-2222-3333-4444-123456789abc"
|
||||||
|
"/dev/vda2")
|
||||||
|
#$marionette))
|
||||||
|
|
||||||
(marionette-eval* '(conclude-installation installer-socket)
|
(marionette-eval* '(conclude-installation installer-socket)
|
||||||
#$marionette)
|
#$marionette)
|
||||||
|
|
||||||
|
@ -1257,8 +1267,12 @@ (define* (installation-target-os-for-gui-tests
|
||||||
'("wheel" "audio" "video"))))
|
'("wheel" "audio" "video"))))
|
||||||
%base-user-accounts))
|
%base-user-accounts))
|
||||||
;; The installer does not create a swap device in guided mode with
|
;; The installer does not create a swap device in guided mode with
|
||||||
;; encryption support.
|
;; encryption support. The installer produces a UUID for the partition;
|
||||||
(swap-devices (if encrypted? '() '("/dev/vda2")))
|
;; this "UUID" is explicitly set in 'gui-test-program' to the value shown
|
||||||
|
;; below.
|
||||||
|
(swap-devices (if encrypted?
|
||||||
|
'()
|
||||||
|
(list (uuid "11111111-2222-3333-4444-123456789abc"))))
|
||||||
(services (cons (service dhcp-client-service-type)
|
(services (cons (service dhcp-client-service-type)
|
||||||
(operating-system-user-services %minimal-os-on-vda)))))
|
(operating-system-user-services %minimal-os-on-vda)))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue