From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mA+2EJFy12FFTAAAgWs5BA (envelope-from ) for ; Thu, 06 Jan 2022 23:52:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id CBIKDpFy12HXUwEA9RJhRA (envelope-from ) for ; Thu, 06 Jan 2022 23:52:01 +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 E4BEE4029C for ; Thu, 6 Jan 2022 23:52:00 +0100 (CET) Received: from localhost ([::1]:49396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5bbz-0003Jw-RV for larch@yhetil.org; Thu, 06 Jan 2022 17:51:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5bZB-0007Tt-HF for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5bZB-00075S-7u for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n5bZB-00005w-6r for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53063] [PATCH wip-harden-installer 08/14] 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: 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.164150932432693 (code B ref 53063); Thu, 06 Jan 2022 22:49:05 +0000 Received: (at 53063) by debbugs.gnu.org; 6 Jan 2022 22:48:44 +0000 Received: from localhost ([127.0.0.1]:42612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bYp-0008V2-M0 for submit@debbugs.gnu.org; Thu, 06 Jan 2022 17:48:44 -0500 Received: from jpoiret.xyz ([206.189.101.64]:36368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bYl-0008Tv-HR 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 BBD39184D98; Thu, 6 Jan 2022 22:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1641509318; 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=qQTJnU8Ttix/W3xOtxbV0Gys8Nsp1n+xNuR7RfJq25+srKrbRmYTA/w+DI+CwPGYANrqqQ qFjjxLz1hM9F65PZw93uxKII01pBBz+y7RkccM+4ybbH73CIbf4Seuofxj5Cv+BH2Pzu33 K4mdQlntvTBg/vOPBynHXQMTiM7F+f6JmeInYJ+KQdH4y6d0RaVbpQhbAoKLQA0hqVTqIb lYSOB9gYholVqW//7H8nrKxjlXWEZ8LQUQfJqNzZj5jUgZzdIN6jhrYwdUHHHpqtylAl3/ OPTQEaFuwjHk2MUOh5jQaR3FCEi7grhvY+DcuCN/z1chTEgZ33YoVTaY/VI60w== Date: Thu, 6 Jan 2022 23:48:06 +0100 Message-Id: In-Reply-To: References: 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=1641509521; 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=cDKrLQHuLVjRrDUqRgLYxmSRZyJyutyBRM0jDHOmFzO/rK3fhqhWQpyfhDS3gueqjdxTuE hqD6txguK/0Xc0a4jM7ma1ZJGFeY4K7t+mRVvIgmVZ40J+yeSR7mfXJl5qePXU+PUrUpSu B41tldkr9HS9U3BKAxxPw5ePkzDpsmc5ZwBde4Eik6WGTvrkPZBEnHLKoNdEa5ocDUOmdo OXB5qhxpKD9/c2YKvMHXBXgvAtDl+6bTJycyNZtxmSq1Rmm1PR397+nAs4y3z/+UT6/4R3 czwe+KrnevqA7A+sYagD53bpe5h/pi4m7jlHG/Mf1rMmDMSc1OIn9x8X3tE6Gw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641509521; a=rsa-sha256; cv=none; b=SwxdUykT/dLSjnUvRi9feJdjVucil7u2/7boHHrbNv/Ee0vmHftz+B2v9vL3t3Rn2b7BEf jW0a/sga0ZskXdaTcbbak7tAMget+Cfvh6F+gf6mwrMMlCCFWQjC8NdBP/+z35a08lSy3g 3GD7Pyxk7sgTfeEP5qq5Wk3+JwQgsMeVRI0X0tiR0YQpR/USkHQF5DExA2Diufi4I2wV2r 6mGOikljtTsTbUkySK9VWlnjCWWc1pIkRENUfQmQNCwuoteqhqcV1yc7RpLWS0LBb/yZJO qTtuL3myxiWEktLBT+m5jCzCmayZNOfW0ZXxRX/otxVcDqUwXm6X6QBwlzQXmw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=qQTJnU8T; 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.90 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=qQTJnU8T; 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: E4BEE4029C X-Spam-Score: -3.90 X-Migadu-Scanner: scn0.migadu.com X-TUID: AQgAYUKYyTlF * 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