From patchwork Thu Jan 6 22:48:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 36064 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1FE2D27BBEA; Thu, 6 Jan 2022 22:52:07 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D3AAE27BBE9 for ; Thu, 6 Jan 2022 22:52:06 +0000 (GMT) Received: from localhost ([::1]:49850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5bc6-0003c5-24 for patchwork@mira.cbaines.net; Thu, 06 Jan 2022 17:52:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5bZC-0007Yn-BW for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5bZC-00075h-1I for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n5bZC-00006A-0V for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53063] [PATCH wip-harden-installer 09/14] installer: Use the command capturing facility for guix init. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 06 Jan 2022 22:49:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53063 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53063@debbugs.gnu.org Cc: Josselin Poiret Received: via spool by 53063-submit@debbugs.gnu.org id=B53063.164150932532712 (code B ref 53063); Thu, 06 Jan 2022 22:49:05 +0000 Received: (at 53063) by debbugs.gnu.org; 6 Jan 2022 22:48:45 +0000 Received: from localhost ([127.0.0.1]:42618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bYq-0008VO-Rk for submit@debbugs.gnu.org; Thu, 06 Jan 2022 17:48:45 -0500 Received: from jpoiret.xyz ([206.189.101.64]:36436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bYm-0008UA-5I for 53063@debbugs.gnu.org; Thu, 06 Jan 2022 17:48:40 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 744B8184F80; Thu, 6 Jan 2022 22:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1641509319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2124ep4QWSUzJKvALK+yOtDYxU0fi0Wa/urQsXhoZDo=; b=JcYlu3InM0QFDCHCHuriE8KNVZyfGVDmdh4piAvxS/D/RwcoFXkwDTSp2lwQ8js+6tvfUh bu+Ull98yOpaSZ+AnzhW7chcjtebebs9uK3EMhIvX1mv3MHQcPo9ZR8gB1l+XXqAP/79de V+j/M74sVh9rouraLtA01rH9XN8CUZleevJigJ/IE1b4AuRhsHTsw5jPE68PVKUnsJLxKR +HPAuyyl1TgyeaDPQwNqtxWAIiILw8bXypJ6j8mt72mU4njA/z1cp4dt2lcHQLNl1UbW4g T5a+fyD4+b3nEFKmCon0v7xM4dIyr1xvde5nnI24JbJ8GPwwykDXe9ikVX9Aeg== Date: Thu, 6 Jan 2022 23:48:07 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches X-Patchwork-Original-From: Josselin Poiret via Guix-patches via From: Josselin Poiret X-getmail-retrieved-from-mailbox: Patches * gnu/installer/newt/final.scm (run-install-shell): Remove procedure, as run-command-in-installer now takes care of everything. (run-final-page): Directly use install-system. * gnu/installer/final.scm (install-system): Restore PATH inside the container, and use run-command-in-installer. --- gnu/installer/final.scm | 17 +++-------------- gnu/installer/newt/final.scm | 10 +--------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index fbfac1f692..ba39dad354 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.scm @@ -169,6 +169,7 @@ (define (assert-exit x) (database-dir "/var/guix/db") (database-file (string-append database-dir "/db.sqlite")) (saved-database (string-append database-dir "/db.save")) + (path (getenv "PATH")) (ret #f)) (mkdir-p (%installer-target-dir)) @@ -205,20 +206,8 @@ (define (assert-exit x) (stop-service 'guix-daemon) (start-service 'guix-daemon (list (number->string (getpid)))) - (setvbuf (current-output-port) 'none) - (setvbuf (current-error-port) 'none) - - ;; If there are any connected clients, assume that we are running - ;; installation tests. In that case, dump the standard and error - ;; outputs to syslog. - (set! ret - (if (not (null? (current-clients))) - (with-output-to-file "/dev/console" - (lambda () - (with-error-to-file "/dev/console" - (lambda () - (run-command install-command))))) - (run-command install-command)))) + (setenv "PATH" path) + (set! ret (apply (run-command-in-installer) install-command))) (lambda () ;; Restart guix-daemon so that it does no keep the MNT namespace ;; alive. diff --git a/gnu/installer/newt/final.scm b/gnu/installer/newt/final.scm index efe422f4f4..07e8cf3864 100644 --- a/gnu/installer/newt/final.scm +++ b/gnu/installer/newt/final.scm @@ -98,14 +98,6 @@ (define (run-install-failed-page) (send-to-clients '(installation-failure)) #t))) -(define* (run-install-shell locale - #:key (users '())) - (clear-screen) - (newt-suspend) - (let ((install-ok? (install-system locale #:users users))) - (newt-resume) - install-ok?)) - (define (run-final-page result prev-steps) (define (wait-for-clients) (unless (null? (current-clients)) @@ -129,7 +121,7 @@ (define (wait-for-clients) user-partitions (configuration->file configuration) (run-config-display-page #:locale locale) - (run-install-shell locale #:users users)))) + (install-system locale #:users users)))) (if install-ok? (run-install-success-page) (run-install-failed-page))))