diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2020-10-23 11:31:56 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-10-30 01:14:21 +0100 |
| commit | 1c6d98533153bc8e0e36236e7fbcf1eb5e178d26 (patch) | |
| tree | fbf06a3262fa92122aedeec1bdba902cfb1f41a6 | |
| parent | 81c3dd9cad29f2b0999aa1f22b3a7d4c04f1a842 (diff) | |
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.
| -rw-r--r-- | gnu/installer/newt/final.scm | 14 | ||||
| -rw-r--r-- | gnu/installer/parted.scm | 7 | ||||
| -rw-r--r-- | gnu/installer/tests.scm | 31 | ||||
| -rw-r--r-- | gnu/tests/install.scm | 18 |
4 files changed, 59 insertions, 11 deletions
diff --git a/gnu/installer/newt/final.scm b/gnu/installer/newt/final.scm index 89684c4d8ad..5019a67429d 100644 --- a/gnu/installer/newt/final.scm +++ b/gnu/installer/newt/final.scm | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #:use-module (srfi srfi-34) | 29 | #:use-module (srfi srfi-34) |
| 30 | #:use-module (srfi srfi-35) | 30 | #:use-module (srfi srfi-35) |
| 31 | #:use-module (ice-9 match) | 31 | #:use-module (ice-9 match) |
| 32 | #:use-module ((ice-9 rdelim) #:select (read-line)) | ||
| 32 | #:use-module (newt) | 33 | #:use-module (newt) |
| 33 | #:export (run-final-page)) | 34 | #:export (run-final-page)) |
| 34 | 35 | ||
| @@ -107,6 +108,19 @@ a specific step, or restart the installer.")) | |||
| 107 | install-ok?)) | 108 | install-ok?)) |
| 108 | 109 | ||
| 109 | (define (run-final-page result prev-steps) | 110 | (define (run-final-page result prev-steps) |
| 111 | (define (wait-for-clients) | ||
| 112 | (unless (null? (current-clients)) | ||
| 113 | (syslog "waiting with clients before starting final step~%") | ||
| 114 | (send-to-clients '(starting-final-step)) | ||
| 115 | (match (select (current-clients) '() '()) | ||
| 116 | (((port _ ...) _ _) | ||
| 117 | (read-line port))))) | ||
| 118 | |||
| 119 | ;; Before generating the configuration file, give clients a chance to do | ||
| 120 | ;; things such as changing the swap partition label. | ||
| 121 | (wait-for-clients) | ||
| 122 | |||
| 123 | (syslog "proceeding with final step~%") | ||
| 110 | (let* ((configuration (format-configuration prev-steps result)) | 124 | (let* ((configuration (format-configuration prev-steps result)) |
| 111 | (user-partitions (result-step result 'partition)) | 125 | (user-partitions (result-step result 'partition)) |
| 112 | (locale (result-step result 'locale)) | 126 | (locale (result-step result 'locale)) |
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index fffd5abf3b0..d799ee0e735 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm | |||
| @@ -1327,7 +1327,12 @@ USER-PARTITIONS, or return nothing." | |||
| 1327 | ,@(initrd-configuration user-partitions) | 1327 | ,@(initrd-configuration user-partitions) |
| 1328 | ,@(if (null? swap-devices) | 1328 | ,@(if (null? swap-devices) |
| 1329 | '() | 1329 | '() |
| 1330 | `((swap-devices (list ,@swap-devices)))) | 1330 | (let* ((uuids (map (lambda (file) |
| 1331 | (uuid->string (read-partition-uuid file))) | ||
| 1332 | swap-devices))) | ||
| 1333 | `((swap-devices (list ,@(map (lambda (uuid) | ||
| 1334 | `(uuid ,uuid)) | ||
| 1335 | uuids)))))) | ||
| 1331 | ,@(if (null? encrypted-partitions) | 1336 | ,@(if (null? encrypted-partitions) |
| 1332 | '() | 1337 | '() |
| 1333 | `((mapped-devices | 1338 | `((mapped-devices |
diff --git a/gnu/installer/tests.scm b/gnu/installer/tests.scm index 58bf0a2700f..f318546a2fd 100644 --- a/gnu/installer/tests.scm +++ b/gnu/installer/tests.scm | |||
| @@ -286,8 +286,9 @@ instrumented for further testing." | |||
| 286 | edit-configuration-file)) | 286 | edit-configuration-file)) |
| 287 | "Converse over PORT to choose the partitioning method. When ENCRYPTED? is | 287 | "Converse over PORT to choose the partitioning method. When ENCRYPTED? is |
| 288 | true, choose full-disk encryption with PASSPHRASE as the LUKS passphrase. | 288 | true, choose full-disk encryption with PASSPHRASE as the LUKS passphrase. |
| 289 | This conversation goes past the final dialog box that shows the configuration | 289 | This conversation stops when the user partitions have been formatted, right |
| 290 | file, actually starting the installation process." | 290 | before the installer generates the configuration file and shows it in a dialog |
| 291 | box." | ||
| 291 | (converse port | 292 | (converse port |
| 292 | ((list-selection (title "Partitioning method") | 293 | ((list-selection (title "Partitioning method") |
| 293 | (multiple-choices? #f) | 294 | (multiple-choices? #f) |
| @@ -330,15 +331,29 @@ file, actually starting the installation process." | |||
| 330 | #t) | 331 | #t) |
| 331 | ((info (title "Preparing partitions") _ ...) | 332 | ((info (title "Preparing partitions") _ ...) |
| 332 | (values)) ;nothing to return | 333 | (values)) ;nothing to return |
| 333 | ((file-dialog (title "Configuration file") | 334 | ((starting-final-step) |
| 334 | (text _) | 335 | ;; Do not return anything. The reply will be sent by |
| 335 | (file ,configuration-file)) | 336 | ;; 'conclude-installation' and in the meantime the installer just waits |
| 336 | (edit-configuration-file configuration-file)))) | 337 | ;; for us, giving us a chance to do things such as changing partition |
| 338 | ;; UUIDs before it generates the configuration file. | ||
| 339 | (values)))) | ||
| 337 | 340 | ||
| 338 | (define (conclude-installation port) | 341 | (define (conclude-installation port) |
| 339 | "Conclude the installation by checking over PORT that we get the final | 342 | "Conclude the installation by checking over PORT that we get the generated |
| 340 | messages once the 'guix system init' process has completed." | 343 | configuration file, accepting it and starting the installation, and then |
| 344 | receiving the final messages once the 'guix system init' process has | ||
| 345 | completed." | ||
| 346 | ;; Assume the previous message received was 'starting-final-step'; here we | ||
| 347 | ;; send the reply to that message, which lets the installer continue. | ||
| 348 | (write #t port) | ||
| 349 | (newline port) | ||
| 350 | (force-output port) | ||
| 351 | |||
| 341 | (converse port | 352 | (converse port |
| 353 | ((file-dialog (title "Configuration file") | ||
| 354 | (text _) | ||
| 355 | (file ,configuration-file)) | ||
| 356 | (edit-configuration-file configuration-file)) | ||
| 342 | ((pause) ;"Press Enter to continue." | 357 | ((pause) ;"Press Enter to continue." |
| 343 | #t) | 358 | #t) |
| 344 | ((installation-complete) ;congratulations! | 359 | ((installation-complete) ;congratulations! |
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 86bd93966b7..2d62a873ca8 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm | |||
| @@ -1211,6 +1211,16 @@ build (current-guix) and then store a couple of full system images.") | |||
| 1211 | #$marionette) | 1211 | #$marionette) |
| 1212 | (screenshot "installer-run.ppm") | 1212 | (screenshot "installer-run.ppm") |
| 1213 | 1213 | ||
| 1214 | (unless #$encrypted? | ||
| 1215 | ;; At this point, user partitions are formatted and the installer is | ||
| 1216 | ;; waiting for us to start the final step: generating the | ||
| 1217 | ;; configuration file, etc. Set a fixed UUID on the swap partition | ||
| 1218 | ;; that matches what 'installation-target-os-for-gui-tests' expects. | ||
| 1219 | (marionette-eval* '(invoke #$(file-append util-linux "/sbin/swaplabel") | ||
| 1220 | "-U" "11111111-2222-3333-4444-123456789abc" | ||
| 1221 | "/dev/vda2") | ||
| 1222 | #$marionette)) | ||
| 1223 | |||
| 1214 | (marionette-eval* '(conclude-installation installer-socket) | 1224 | (marionette-eval* '(conclude-installation installer-socket) |
| 1215 | #$marionette) | 1225 | #$marionette) |
| 1216 | 1226 | ||
| @@ -1257,8 +1267,12 @@ build (current-guix) and then store a couple of full system images.") | |||
| 1257 | '("wheel" "audio" "video")))) | 1267 | '("wheel" "audio" "video")))) |
| 1258 | %base-user-accounts)) | 1268 | %base-user-accounts)) |
| 1259 | ;; The installer does not create a swap device in guided mode with | 1269 | ;; The installer does not create a swap device in guided mode with |
| 1260 | ;; encryption support. | 1270 | ;; encryption support. The installer produces a UUID for the partition; |
| 1261 | (swap-devices (if encrypted? '() '("/dev/vda2"))) | 1271 | ;; this "UUID" is explicitly set in 'gui-test-program' to the value shown |
| 1272 | ;; below. | ||
| 1273 | (swap-devices (if encrypted? | ||
| 1274 | '() | ||
| 1275 | (list (uuid "11111111-2222-3333-4444-123456789abc")))) | ||
| 1262 | (services (cons (service dhcp-client-service-type) | 1276 | (services (cons (service dhcp-client-service-type) |
| 1263 | (operating-system-user-services %minimal-os-on-vda))))) | 1277 | (operating-system-user-services %minimal-os-on-vda))))) |
| 1264 | 1278 | ||
