Archived
1
0
Fork 0

installer: Improve install device detection.

* gnu/installer/parted.scm (non-install-devices): Improve the detection by
assuming that any device with the ISO9660 label is the installation device.
This commit is contained in:
Mathieu Othacehe 2021-06-12 18:40:39 +02:00
parent 7479124cd7
commit 154a4e0462
No known key found for this signature in database
GPG key ID: 8354763531769CA6

View file

@ -24,7 +24,8 @@
#:use-module (gnu installer newt page) #:use-module (gnu installer newt page)
#:use-module (gnu system uuid) #:use-module (gnu system uuid)
#:use-module ((gnu build file-systems) #:use-module ((gnu build file-systems)
#:select (read-partition-uuid #:select (find-partition-by-label
read-partition-uuid
read-luks-partition-uuid)) read-luks-partition-uuid))
#:use-module ((gnu build linux-modules) #:use-module ((gnu build linux-modules)
#:select (missing-modules)) #:select (missing-modules))
@ -338,14 +339,17 @@ fail. See rereadpt function in wipefs.c of util-linux for an explanation."
(invoke "dmsetup" "remove_all"))) (invoke "dmsetup" "remove_all")))
(define (non-install-devices) (define (non-install-devices)
"Return all the available devices, except the busy one, allegedly the "Return all the available devices, except the install device."
install device. DEVICE-IS-BUSY? is a parted call, checking if the device is ;; XXX: The install image uses an overlayfs so detecting the install device
mounted." ;; is not easy. Assume that a given device is the installation device if it
;; FIXME: The install image uses an overlayfs so the install device does not ;; is reported as busy by parted or if its label is the ISO9660 image label.
;; appear as mounted and won't be considered as busy.
(remove (lambda (device) (remove (lambda (device)
(let ((file-name (device-path device))) (let ((file-name (device-path device))
(device-is-busy? device))) (install-file-name
(find-partition-by-label "GUIX_IMAGE")))
(or (device-is-busy? device)
(and install-file-name
(string=? file-name install-file-name)))))
(devices))) (devices)))