From patchwork Thu Jan 6 22:45:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 550 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 53FD427BBEA; Thu, 6 Jan 2022 22:47:13 +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 CEDCB27BBE9 for ; Thu, 6 Jan 2022 22:47:12 +0000 (GMT) Received: from localhost ([::1]:42686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5bXL-0006Xe-Bn for patchwork@mira.cbaines.net; Thu, 06 Jan 2022 17:47:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5bXE-0006XU-Av for guix-patches@gnu.org; Thu, 06 Jan 2022 17:47:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5bXC-0006sY-10 for guix-patches@gnu.org; Thu, 06 Jan 2022 17:47:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n5bXB-0008OP-OP for guix-patches@gnu.org; Thu, 06 Jan 2022 17:47:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53063] [PATCH wip-harden-installer 00/14] General improvements to the installer Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 06 Jan 2022 22:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53063 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53063@debbugs.gnu.org Cc: Josselin Poiret X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164150917232194 (code B ref -1); Thu, 06 Jan 2022 22:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 6 Jan 2022 22:46:12 +0000 Received: from localhost ([127.0.0.1]:42568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bWO-0008NB-8G for submit@debbugs.gnu.org; Thu, 06 Jan 2022 17:46:12 -0500 Received: from lists.gnu.org ([209.51.188.17]:43512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bWJ-0008N1-Cw for submit@debbugs.gnu.org; Thu, 06 Jan 2022 17:46:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5bWJ-0005tV-6Q for guix-patches@gnu.org; Thu, 06 Jan 2022 17:46:07 -0500 Received: from jpoiret.xyz ([206.189.101.64]:34120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5bWE-0006io-D3 for guix-patches@gnu.org; Thu, 06 Jan 2022 17:46:06 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 1797E184D98; Thu, 6 Jan 2022 22:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1641509159; 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; bh=8rsB9L5rpCgDPZJNg41WqEQS+KVE4/rUk8PIXa7h89c=; b=CvGcIC1Y5caKCOcCcI8kwipMuyfyZCqBlNp/y/vMbOmi8gHvuGqVypPgk+dmkD2njhn+Ny zLUPLcbhPKsDga5tNdbV4GK6hkRfpPusyyibyNvBmC3kO8q9NYYvdm/xS8kdLL2G6UyTjz v0XnHoMtTp+hNFN3ANQk+x5H7PXbCLJt0sJBe0Yv60CxIefsuv5RN18kqs8nzeRclZUHZu 0TrD9aGOj4lhGWjeBhH6PVgKWDJZknD8ZO7sH8JU08avNEYkg0BfKGIZQzAM9EY+LAeEAr P/x/gCHzwZLlWqnVQEmgH1RZP0aChjHZjXcKVJI0rRAMcd1gDXqh7BTCFI3NjA== Date: Thu, 6 Jan 2022 23:45:45 +0100 Message-Id: MIME-Version: 1.0 X-Spamd-Bar: ++++ Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz Received-SPF: pass client-ip=206.189.101.64; envelope-from=dev@jpoiret.xyz; helo=jpoiret.xyz X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=0.001, PDS_OTHER_BAD_TLD=1.999, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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 Hello everyone, Here are some miscellaneous improvements to the installer. Here is a run down of the bigger changes: * Patches 2 to 4 move logging from simply putting everything in syslog to a more flexible approach, logging lines to multiple targets. One new target is a per-install /tmp/installer.{DATETIME}.log. * Patches 5 and 6 add a new alternative to invoke (or system*), which forks to a new child process with a pipe back to the main process, sets stdout and stderr to that pipe followed by execlp'ing the command, while the main process reads from the pipe and applies some configurable procedures to each line of output. This lets us log all external command output using the same facility as the installer itself, while displaying everything to the user. Patch 6 is "optional", as it is there simply to avoid getting "Error in finalization thread: Success". * Patches 7 to 9 add a parameter run-command-in-installer, that is an installer-specific way of running external commands. Here, the Newt installer one simply suspends newt and runs the command in the terminal. * Patch 13 modifies the installer step aborting mechanism to use general prompts instead of the exception system. This was done so that a following patchset (which will hopefully be coming soon) is able to abort an installer step from an exception handling code that is outside of the run-installer-steps. You could also say that it is cleaner :). * Patch 14 adds a new confirmation page before running any external command, with the possibility to abort the current installer step. The next step should be moving installer-program in (gnu installer) to use SRFI-34/35 exception handling over the current throw/catch one, as the current code doesn't display those properly. Josselin Poiret (14): installer: Use define instead of let at top-level. installer: Generalize logging facility. installer: Use new installer-log-line everywhere. installer: Un-export syslog syntax. installer: Capture external commands output. installer: Disable automatic finalization for child thread. installer: Add installer-specific run command process. installer: Use run-command-in-installer in (gnu installer parted). installer: Use the command capturing facility for guix init. installer: Raise condition when mklabel fails. installer: Fix run-file-textbox-page when edit-button is #f. installer: Replace run-command by invoke in newt/page.scm. installer: Use named prompt to abort or break installer steps. installer: Add confirmation page when running external commands. gnu/installer.scm | 15 ++- gnu/installer/final.scm | 23 +--- gnu/installer/newt.scm | 22 ++- gnu/installer/newt/ethernet.scm | 8 +- gnu/installer/newt/final.scm | 22 +-- gnu/installer/newt/keymap.scm | 8 +- gnu/installer/newt/locale.scm | 25 ++-- gnu/installer/newt/network.scm | 16 +-- gnu/installer/newt/page.scm | 22 +-- gnu/installer/newt/partition.scm | 10 +- gnu/installer/newt/services.scm | 16 +-- gnu/installer/newt/timezone.scm | 4 +- gnu/installer/newt/user.scm | 5 +- gnu/installer/newt/welcome.scm | 2 +- gnu/installer/newt/wifi.scm | 4 +- gnu/installer/parted.scm | 104 +++++++------- gnu/installer/record.scm | 7 +- gnu/installer/steps.scm | 127 ++++++++--------- gnu/installer/utils.scm | 225 +++++++++++++++++++++++++++---- 19 files changed, 389 insertions(+), 276 deletions(-)