From patchwork Thu Nov 25 09:20:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 34805 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 E1E9827BBEA; Thu, 25 Nov 2021 09:22:28 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable 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 A578827BBE9 for ; Thu, 25 Nov 2021 09:22:28 +0000 (GMT) Received: from localhost ([::1]:37056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqAxX-0003wR-Lb for patchwork@mira.cbaines.net; Thu, 25 Nov 2021 04:22:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqAwA-0002YT-GS for guix-patches@gnu.org; Thu, 25 Nov 2021 04:21:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:44186) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mqAwA-00069g-7d for guix-patches@gnu.org; Thu, 25 Nov 2021 04:21:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mqAwA-00054p-1i for guix-patches@gnu.org; Thu, 25 Nov 2021 04:21:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51878] [PATCH] installer: Rework installation device detection Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Nov 2021 09:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51878 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Josselin Poiret Cc: 51878@debbugs.gnu.org Received: via spool by 51878-submit@debbugs.gnu.org id=B51878.163783203919465 (code B ref 51878); Thu, 25 Nov 2021 09:21:02 +0000 Received: (at 51878) by debbugs.gnu.org; 25 Nov 2021 09:20:39 +0000 Received: from localhost ([127.0.0.1]:55732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqAvm-00053t-Ty for submit@debbugs.gnu.org; Thu, 25 Nov 2021 04:20:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqAvl-00053h-Al for 51878@debbugs.gnu.org; Thu, 25 Nov 2021 04:20:37 -0500 Received: from [2001:470:142:3::e] (port=34398 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqAvg-0005sQ-2D; Thu, 25 Nov 2021 04:20:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=ukUhF9WLIqOklJE95rClVLaOHT4Gn8Xg13nkWUYL9LI=; b=DJfuvI251KTyu4lt/Lti NEuHF7A/CCU8vBAZr2i+g1grPXg/s36wuCRRv8lGmwfa+c4uZI0lNepvaHryAcHpUa5+d6GzDdOWU 0Y1VwXhoEOcjFbaTUVnAl603JzyWcSq33co/AoDDyK6J4ZWIbfqq4tnpykQd6wg/rHkZoqxt+xXas hvq9ZKGzXSHMRJg6/k6nCH8gl94gXP8kJU8iEjTCBWRK/v+R2NQ6QhRmkWFJoEfUOCwhEPenOWLQK ouaP4uIQ783KApWzZeB1jXwnh2Q8Ie4rNogpytdAu5aVhPVx077XTLO+IABi8zq+uXJUehNNBfi1/ YgsAulYjt8varQ==; Received: from [2a01:e0a:19b:d9a0:45b5:a14a:5c75:5737] (port=46972 helo=meije) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqAvf-0001li-RR; Thu, 25 Nov 2021 04:20:32 -0500 From: Mathieu Othacehe References: <87lf1mhmgw.fsf@gnu.org> <20211123221909.11142-1-dev@jpoiret.xyz> Date: Thu, 25 Nov 2021 09:20:30 +0000 In-Reply-To: <20211123221909.11142-1-dev@jpoiret.xyz> (Josselin Poiret's message of "Tue, 23 Nov 2021 22:19:09 +0000") Message-ID: <87y25cmw0x.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches Hello Josselin, Thanks for the v2! > I didn't quite get your comment about filtering the `(devices)` list. > In both cases, we use `remove`, but here I've factored out the predicate > used for it. I was not very clear sorry about that. I meant something like that seems a little more concise: --8<---------------cut here---------------start------------->8--- WDYT? Thanks, Mathieu diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index 82b01d2ce1..ad7dd6bf91 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -366,19 +366,16 @@ (define the-installer-root-partition-path ;; we're booting from to determine if it is the installation ;; device. (define (installation-device? device) + ;; When using CDROM based installation, the root partition path may be the + ;; device path. (or (string=? the-installer-root-partition-path (device-path device)) (let ((disk (disk-new device))) (and disk - (let loop ((partition #f)) - (let ((next-partition (disk-next-partition disk - #:partition - partition))) - (and next-partition - (or (string=? the-installer-root-partition-path - (partition-get-path - next-partition)) - (loop next-partition))))))))) + (any (lambda (partition) + (string=? the-installer-root-partition-path + (partition-get-path partition))) + (disk-partitions disk)))))) (remove installation-device? (devices))) --8<---------------cut here---------------end--------------->8---