diff mbox series

[bug#51878] installer: Rework installation device detection

Message ID 87y25cmw0x.fsf_-_@gnu.org
State Accepted
Headers show
Series [bug#51878] installer: Rework installation device detection | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Mathieu Othacehe Nov. 25, 2021, 9:20 a.m. UTC
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

Comments

Josselin Poiret Nov. 26, 2021, 9:48 a.m. UTC | #1
Mathieu Othacehe <othacehe@gnu.org> writes:

> Hello Josselin,
> I was not very clear sorry about that. I meant something like that seems
> a little more concise:
>
> --8<---------------cut here---------------start------------->8---
> snip
> --8<---------------cut here---------------end--------------->8---
>
> WDYT?

I agree that this reads better!  Feel free to push with those changes.

Best,
Josselin Poiret
Mathieu Othacehe Nov. 26, 2021, 10:53 a.m. UTC | #2
Hey,

> I agree that this reads better!  Feel free to push with those changes.

Pushed as b90504cdb5ce3d1981c8d7bc8a9cc918b0d60af7.

Thanks,

Mathieu
diff mbox series

Patch

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