unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <othacehe@gnu.org>
To: Josselin Poiret <dev@jpoiret.xyz>
Cc: 51878@debbugs.gnu.org
Subject: [bug#51878] [PATCH] installer: Rework installation device detection
Date: Wed, 17 Nov 2021 14:43:11 +0000	[thread overview]
Message-ID: <87lf1mhmgw.fsf@gnu.org> (raw)
In-Reply-To: <20211115210404.10680-1-dev@jpoiret.xyz> (Josselin Poiret's message of "Mon, 15 Nov 2021 21:04:04 +0000")


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




  parent reply	other threads:[~2021-11-17 14:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 21:04 [bug#51878] [PATCH] installer: Rework installation device detection Josselin Poiret via Guix-patches via
2021-11-15 21:32 ` [bug#51878] [PATCH v2] " Josselin Poiret via Guix-patches via
2021-11-17 14:43 ` Mathieu Othacehe [this message]
2021-11-23 22:19   ` Josselin Poiret via Guix-patches via
2021-11-25  9:20     ` [bug#51878] [PATCH] " Mathieu Othacehe
2021-11-26  9:48       ` Josselin Poiret via Guix-patches via
2021-11-26 10:53         ` bug#51878: " Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf1mhmgw.fsf@gnu.org \
    --to=othacehe@gnu.org \
    --cc=51878@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).