guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#51878] [PATCH] installer: Rework installation device detection


From: Mathieu Othacehe
Subject: [bug#51878] [PATCH] installer: Rework installation device detection
Date: Thu, 25 Nov 2021 09:20:30 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

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---
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---

WDYT?

Thanks,

Mathieu





reply via email to

[Prev in Thread] Current Thread [Next in Thread]