From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oM7cGC16mV/0VQAA0tVLHw (envelope-from ) for ; Wed, 28 Oct 2020 14:03:25 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id sHu1FC16mV+2CQAAB5/wlQ (envelope-from ) for ; Wed, 28 Oct 2020 14:03:25 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ACD109405D1 for ; Wed, 28 Oct 2020 14:03:24 +0000 (UTC) Received: from localhost ([::1]:42622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXm2t-00025m-3v for larch@yhetil.org; Wed, 28 Oct 2020 10:03:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXlvn-0000g1-I2 for guix-patches@gnu.org; Wed, 28 Oct 2020 09:56:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38434) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXlvn-0003Xa-7o for guix-patches@gnu.org; Wed, 28 Oct 2020 09:56:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kXlvm-0006gd-TD for guix-patches@gnu.org; Wed, 28 Oct 2020 09:56:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#44169] [PATCH v2 3/3] installer: Use UUIDs in the 'swap-devices' field. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 28 Oct 2020 13:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44169 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 44169@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 44169-submit@debbugs.gnu.org id=B44169.160389335125682 (code B ref 44169); Wed, 28 Oct 2020 13:56:02 +0000 Received: (at 44169) by debbugs.gnu.org; 28 Oct 2020 13:55:51 +0000 Received: from localhost ([127.0.0.1]:49978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXlva-0006g5-O6 for submit@debbugs.gnu.org; Wed, 28 Oct 2020 09:55:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51916) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXlvW-0006fg-Db for 44169@debbugs.gnu.org; Wed, 28 Oct 2020 09:55:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44165) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXlvR-0003Vv-5s; Wed, 28 Oct 2020 09:55:41 -0400 Received: from vpn-0-27.aquilenet.fr ([2a0c:e300:4:27::]:38634 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kXlvQ-0001bF-9r; Wed, 28 Oct 2020 09:55:40 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 28 Oct 2020 14:54:57 +0100 Message-Id: <20201028135457.23335-3-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028135457.23335-1-ludo@gnu.org> References: <87imaxdwv5.fsf@gnu.org> <20201028135457.23335-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 3.49 X-TUID: Qx3e5XhBv2EF 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. --- gnu/installer/newt/final.scm | 14 ++++++++++++++ gnu/installer/parted.scm | 7 ++++++- gnu/installer/tests.scm | 31 +++++++++++++++++++++++-------- 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 89684c4d8a..5019a67429 100644 --- a/gnu/installer/newt/final.scm +++ b/gnu/installer/newt/final.scm @@ -29,6 +29,7 @@ #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (ice-9 match) + #:use-module ((ice-9 rdelim) #:select (read-line)) #:use-module (newt) #:export (run-final-page)) @@ -107,6 +108,19 @@ a specific step, or restart the installer.")) install-ok?)) (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)) (user-partitions (result-step result 'partition)) (locale (result-step result 'locale)) diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index fffd5abf3b..d799ee0e73 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -1327,7 +1327,12 @@ USER-PARTITIONS, or return nothing." ,@(initrd-configuration user-partitions) ,@(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) '() `((mapped-devices diff --git a/gnu/installer/tests.scm b/gnu/installer/tests.scm index 58bf0a2700..f318546a2f 100644 --- a/gnu/installer/tests.scm +++ b/gnu/installer/tests.scm @@ -286,8 +286,9 @@ instrumented for further testing." edit-configuration-file)) "Converse over PORT to choose the partitioning method. When ENCRYPTED? is true, choose full-disk encryption with PASSPHRASE as the LUKS passphrase. -This conversation goes past the final dialog box that shows the configuration -file, actually starting the installation process." +This conversation stops when the user partitions have been formatted, right +before the installer generates the configuration file and shows it in a dialog +box." (converse port ((list-selection (title "Partitioning method") (multiple-choices? #f) @@ -330,15 +331,29 @@ file, actually starting the installation process." #t) ((info (title "Preparing partitions") _ ...) (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") (text _) (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 + (edit-configuration-file configuration-file)) ((pause) ;"Press Enter to continue." #t) ((installation-complete) ;congratulations! diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 86bd93966b..2d62a873ca 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.") #$marionette) (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) @@ -1257,8 +1267,12 @@ build (current-guix) and then store a couple of full system images.") '("wheel" "audio" "video")))) %base-user-accounts)) ;; The installer does not create a swap device in guided mode with - ;; encryption support. - (swap-devices (if encrypted? '() '("/dev/vda2"))) + ;; encryption support. The installer produces a UUID for the partition; + ;; 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) (operating-system-user-services %minimal-os-on-vda))))) -- 2.28.0