GNU bug report logs -
#51878
[PATCH] installer: Rework installation device detection
Previous Next
Reported by: Josselin Poiret <dev <at> jpoiret.xyz>
Date: Mon, 15 Nov 2021 21:05:02 UTC
Severity: normal
Tags: patch
Done: Mathieu Othacehe <othacehe <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 51878 <at> debbugs.gnu.org (full text, mbox):
Hello Josselin,
> properly detect the device as it was comparing a disk block device path (eg
> `/dev/sda`) with a partition block device path (`/dev/sda2`). Instead, this
When using an ISO installer image,
> - (or (read-only? device)
> - (and install-device
> - (string=? file-name install-device)))))
> - (devices))))
file-name and install-device both equal "/dev/sr0" for the cdrom device,
which means it will be correctly filtered out. Is it handled correctly
with your patch?
When using a raw disk image, we may indeed compare devices and
partitions currently.
> +
> + (define the-intaller-root-partition-path
> + (installer-root-partition-path))
> +
> + ;; Read partition table of device and compare each path to the one
> + ;; we're booting from to determine if it is the installation
> + ;; device.
> + (define (installation-device? 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))))))))
Filtering the "(devices)" list can cause extra iterations compared to
your implementation, but is easier to read I think.
Thanks,
Mathieu
This bug report was last modified 3 years and 270 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.