linux-initrd: Report only missing modules, not all needed modules.

Previously the warning would list all the required modules rather than
just those that are missing.

* gnu/system/mapped-devices.scm (check-device-initrd-modules): Compute
'missing' and report it.
This commit is contained in:
Ludovic Courtès 2018-07-29 18:45:18 +02:00
parent fcd068e984
commit 99b78ba498
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 11 additions and 10 deletions

View File

@ -128,15 +128,16 @@ DEVICE must be a \"/dev\" file name."
(const #f))) (const #f)))
(when aliases (when aliases
(let ((modules (delete-duplicates (let* ((modules (delete-duplicates
(append-map (cut matching-modules <> aliases) (append-map (cut matching-modules <> aliases)
(device-module-aliases device)))) (device-module-aliases device))))
;; Module names (not file names) are supposed to use underscores ;; Module names (not file names) are supposed to use underscores
;; instead of hyphens. MODULES is a list of module names, whereas ;; instead of hyphens. MODULES is a list of module names, whereas
;; LINUX-MODULES is file names without '.ko', so normalize them. ;; LINUX-MODULES is file names without '.ko', so normalize them.
(provided (map file-name->module-name linux-modules))) (provided (map file-name->module-name linux-modules))
(unless (every (cut member <> provided) modules) (missing (remove (cut member <> provided) modules)))
(unless (null? missing)
;; Note: What we suggest here is a list of module names (e.g., ;; Note: What we suggest here is a list of module names (e.g.,
;; "usb_storage"), not file names (e.g., "usb-storage.ko"). This is ;; "usb_storage"), not file names (e.g., "usb-storage.ko"). This is
;; OK because we have machinery that accepts both the hyphen and the ;; OK because we have machinery that accepts both the hyphen and the
@ -145,7 +146,7 @@ DEVICE must be a \"/dev\" file name."
(&message (&message
(message (format #f (G_ "you may need these modules \ (message (format #f (G_ "you may need these modules \
in the initrd for ~a:~{ ~a~}") in the initrd for ~a:~{ ~a~}")
device modules))) device missing)))
(&fix-hint (&fix-hint
(hint (format #f (G_ "Try adding them to the (hint (format #f (G_ "Try adding them to the
@code{initrd-modules} field of your @code{operating-system} declaration, along @code{initrd-modules} field of your @code{operating-system} declaration, along
@ -157,7 +158,7 @@ these lines:
(initrd-modules (append (list~{ ~s~}) (initrd-modules (append (list~{ ~s~})
%base-initrd-modules))) %base-initrd-modules)))
@end example\n") @end example\n")
modules))) missing)))
(&error-location (&error-location
(location (source-properties->location location))))))))) (location (source-properties->location location)))))))))