From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8Ek7NavR4mGHxgAAgWs5BA (envelope-from ) for ; Sat, 15 Jan 2022 14:52:43 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 2KDRMqvR4mFnJwAA9RJhRA (envelope-from ) for ; Sat, 15 Jan 2022 14:52:43 +0100 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 7DC142A10B for ; Sat, 15 Jan 2022 14:52:43 +0100 (CET) Received: from localhost ([::1]:40152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n8jU2-0006Y0-Ij for larch@yhetil.org; Sat, 15 Jan 2022 08:52:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8jSV-0005FZ-Lc for guix-patches@gnu.org; Sat, 15 Jan 2022 08:51:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n8jST-0004Fd-QO for guix-patches@gnu.org; Sat, 15 Jan 2022 08:51:07 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n8jST-0001rR-Pl for guix-patches@gnu.org; Sat, 15 Jan 2022 08:51:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53063] [PATCH v2 wip-harden-installer 09/18] installer: Use run-command-in-installer in (gnu installer parted). Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 15 Jan 2022 13:51: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: Mathieu Othacehe Cc: 53063@debbugs.gnu.org, ludo@gnu.org, Josselin Poiret Received: via spool by 53063-submit@debbugs.gnu.org id=B53063.16422546447037 (code B ref 53063); Sat, 15 Jan 2022 13:51:05 +0000 Received: (at 53063) by debbugs.gnu.org; 15 Jan 2022 13:50:44 +0000 Received: from localhost ([127.0.0.1]:39512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8jS7-0001pD-2W for submit@debbugs.gnu.org; Sat, 15 Jan 2022 08:50:43 -0500 Received: from jpoiret.xyz ([206.189.101.64]:48758) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8jRv-0001ma-Cn for 53063@debbugs.gnu.org; Sat, 15 Jan 2022 08:50:31 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id B3969184F87; Sat, 15 Jan 2022 13:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1642254631; 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=PSREt5ETZiXWQ8qm7QSd/ScalJZ07QaEydkk3Jt/kyE=; b=tor7QKiNxypHp2EiAPWrh7b9ikt6nrGFa/sjuV9wgkbWtoKyV+p6TeaQz69LlAOsuYJyVj VdlhWAfV8Y4ll2HMKGiXG8s2riwGLz4f70t0MZXAdq4852zU21v5UZGoyZCyRYb5jDb4rF jykQUzRRerjejtF9GshANFUgCyP8DEOqB8CxH96jAVCbdIbApLegm9IFcnyt9R2fB5o3Rr /wOiy5y4GDUP6L1+DGpUUALlGEWb5AOdztVIJe3ddr10FnAXq8eIAfBBpFHU//d7Ur9tjH xN47knNlQZOkrphOD/10s6t5v6GXGbT0ZYIDL/yiZIOF4aEaMddEBXk+pIE2LA== Date: Sat, 15 Jan 2022 14:50:02 +0100 Message-Id: <20220115135011.5817-10-dev@jpoiret.xyz> In-Reply-To: <20220115135011.5817-1-dev@jpoiret.xyz> References: <8735lz4xsv.fsf@gnu.org> <20220115135011.5817-1-dev@jpoiret.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches From: Josselin Poiret via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642254763; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=PSREt5ETZiXWQ8qm7QSd/ScalJZ07QaEydkk3Jt/kyE=; b=L3/OJx5ggfoI+TXjc+pvbpHPO8rlgEZA3zFtEz7s2HJjMo2fWCFoY6OMJ2o61JbnbyT7tV xbiDJWPRLNbnrnrGJx5vjIX6A1w1gLvPbW8fLfR9jEXKC0xSRqri84pW6ktUzO9NjvYxIu kJzox1IEaQKs8aXQpsOZ1IYaCCCw3bEEP6dEG+76LcIid7BJFIRDqNg2H0LTcNOBMnFPZa +44plhKR55pReYwlkT/WXNtxt60Yp2o4V3avzuK1nqPW2WufFT+T/4/gjbbkKx0zPyuCJ2 IBUBcRqkEDB78XeKJdJ3v/h0ijTjNqzsNUxcsLX/UH2v8Sb732vUucG4oiwkXg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642254763; a=rsa-sha256; cv=none; b=Y7iwV2ZH7tUqwwNFbRhvU4nAvhxxK+qBBDhIqH8Wc09KEXrQshNcntY5CrBKXTMVfhDOe5 UR+dznWMV5bELdP6Mr+1PaIvzECfXkZzTwJcQy40KkSU/n7ZSyAw2SXtLDwUMkHgWKRAzc GZh0xyZxTaAphJKwRymjTn6sLi0inBcRxdrk9JJKtUs7rkw8PoX6Efk8IA5xD2OJJ7K7gt zusOMu3JnDDqTzQUC0ps3LX9ggeqqscTAXuJYGi/TK6xV7xdM5H0lYLdHoc0Qtv6WdZr9P +f0zWrHVxqRaMWoCvytGAvRyGhVVCAauJPYOG0CKP/oa/SqVy6WoD+RBPtL/+Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=tor7QKiN; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.93 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=tor7QKiN; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 7DC142A10B X-Spam-Score: -3.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: u/Hrs4mrOQXv * gnu/installer/parted.scm (remove-logical-devices, create-btrfs-file-system, create-ext4-file-system, create-fat16-file-system, create-fat32-file-system, create-jfs-file-system, create-ntfs-file-system, create-xfs-file-system, create-swap-partition, luks-format-and-open, luks-close): Use run-command-in-installer. (with-null-output-ports): Remove. --- gnu/installer/parted.scm | 44 +++++++++++++--------------------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index ced7a757d7..c8bb73ee64 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -343,8 +343,7 @@ (define* (force-device-sync device) (define (remove-logical-devices) "Remove all active logical devices." - (with-null-output-ports - (invoke "dmsetup" "remove_all"))) + ((run-command-in-installer) "dmsetup" "remove_all")) (define (installer-root-partition-path) "Return the root partition path, or #f if it could not be detected." @@ -1115,53 +1114,37 @@ (define (set-user-partitions-file-name user-partitions) (file-name file-name)))) user-partitions)) -(define-syntax-rule (with-null-output-ports exp ...) - "Evaluate EXP with both the output port and the error port pointing to the -bit bucket." - (with-output-to-port (%make-void-port "w") - (lambda () - (with-error-to-port (%make-void-port "w") - (lambda () exp ...))))) - (define (create-btrfs-file-system partition) "Create a btrfs file-system for PARTITION file-name." - (with-null-output-ports - (invoke "mkfs.btrfs" "-f" partition))) + ((run-command-in-installer) "mkfs.btrfs" "-f" partition)) (define (create-ext4-file-system partition) "Create an ext4 file-system for PARTITION file-name." - (with-null-output-ports - (invoke "mkfs.ext4" "-F" partition))) + ((run-command-in-installer) "mkfs.ext4" "-F" partition)) (define (create-fat16-file-system partition) "Create a fat16 file-system for PARTITION file-name." - (with-null-output-ports - (invoke "mkfs.fat" "-F16" partition))) + ((run-command-in-installer) "mkfs.fat" "-F16" partition)) (define (create-fat32-file-system partition) "Create a fat32 file-system for PARTITION file-name." - (with-null-output-ports - (invoke "mkfs.fat" "-F32" partition))) + ((run-command-in-installer) "mkfs.fat" "-F32" partition)) (define (create-jfs-file-system partition) "Create a JFS file-system for PARTITION file-name." - (with-null-output-ports - (invoke "jfs_mkfs" "-f" partition))) + ((run-command-in-installer) "jfs_mkfs" "-f" partition)) (define (create-ntfs-file-system partition) "Create a JFS file-system for PARTITION file-name." - (with-null-output-ports - (invoke "mkfs.ntfs" "-F" "-f" partition))) + ((run-command-in-installer) "mkfs.ntfs" "-F" "-f" partition)) (define (create-xfs-file-system partition) "Create an XFS file-system for PARTITION file-name." - (with-null-output-ports - (invoke "mkfs.xfs" "-f" partition))) + ((run-command-in-installer) "mkfs.xfs" "-f" partition)) (define (create-swap-partition partition) "Set up swap area on PARTITION file-name." - (with-null-output-ports - (invoke "mkswap" "-f" partition))) + ((run-command-in-installer) "mkswap" "-f" partition)) (define (call-with-luks-key-file password proc) "Write PASSWORD in a temporary file and pass it to PROC as argument." @@ -1190,15 +1173,16 @@ (define (luks-format-and-open user-partition) (lambda (key-file) (installer-log-line "formatting and opening LUKS entry ~s at ~s" label file-name) - (system* "cryptsetup" "-q" "luksFormat" file-name key-file) - (system* "cryptsetup" "open" "--type" "luks" - "--key-file" key-file file-name label))))) + ((run-command-in-installer) "cryptsetup" "-q" "luksFormat" + file-name key-file) + ((run-command-in-installer) "cryptsetup" "open" "--type" "luks" + "--key-file" key-file file-name label))))) (define (luks-close user-partition) "Close the encrypted partition pointed by USER-PARTITION." (let ((label (user-partition-crypt-label user-partition))) (installer-log-line "closing LUKS entry ~s" label) - (system* "cryptsetup" "close" label))) + ((run-command-in-installer) "cryptsetup" "close" label))) (define (format-user-partitions user-partitions) "Format the records in USER-PARTITIONS list with -- 2.34.0