summaryrefslogtreecommitdiff
path: root/gnu/system/mapped-devices.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-03-13 17:11:19 +0100
committerLudovic Courtès <ludo@gnu.org>2019-03-13 23:12:43 +0100
commit4cd386afae444f3ee603cd07d282b2eee3253555 (patch)
tree048222e135ac36378bed3ced318fd0055f9fc4ea /gnu/system/mapped-devices.scm
parent59e80445882f8b0379e54916f89510c0deda6698 (diff)
linux-modules: Factorize 'missing-modules'.
* gnu/build/linux-modules.scm (missing-modules): New procedure. * gnu/system/mapped-devices.scm (check-device-initrd-modules): Use it.
Diffstat (limited to 'gnu/system/mapped-devices.scm')
-rw-r--r--gnu/system/mapped-devices.scm55
1 files changed, 22 insertions, 33 deletions
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index e29ad3ad38..7c58f876a3 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -32,8 +32,7 @@
#:use-module (gnu system uuid)
#:autoload (gnu build file-systems) (find-partition-by-luks-uuid)
#:autoload (gnu build linux-modules)
- (device-module-aliases matching-modules known-module-aliases
- normalize-module-name file-name->module-name)
+ (missing-modules)
#:autoload (gnu packages cryptsetup) (cryptsetup-static)
#:autoload (gnu packages linux) (mdadm-static)
#:use-module (srfi srfi-1)
@@ -118,37 +117,27 @@
(define (check-device-initrd-modules device linux-modules location)
"Raise an error if DEVICE needs modules beyond LINUX-MODULES to operate.
DEVICE must be a \"/dev\" file name."
- (define aliases
- ;; Attempt to load 'modules.alias' from the current kernel, assuming we're
- ;; on Guix System, and assuming that corresponds to the kernel we'll be
- ;; installing. Skip the whole thing if that file cannot be read.
+ (define missing
+ ;; Attempt to determine missing modules.
(catch 'system-error
(lambda ()
- (known-module-aliases))
- (const #f)))
-
- (when aliases
- (let* ((modules (delete-duplicates
- (append-map (cut matching-modules <> aliases)
- (device-module-aliases device))))
-
- ;; Module names (not file names) are supposed to use underscores
- ;; instead of hyphens. MODULES is a list of module names, whereas
- ;; LINUX-MODULES is file names without '.ko', so normalize them.
- (provided (map file-name->module-name linux-modules))
- (missing (remove (cut member <> provided) modules)))
- (unless (null? missing)
- ;; 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
- ;; OK because we have machinery that accepts both the hyphen and the
- ;; underscore version.
- (raise (condition
- (&message
- (message (format #f (G_ "you may need these modules \
+ (missing-modules device linux-modules))
+
+ ;; If we can't do that (e.g., EPERM), skip the whole thing.
+ (const '())))
+
+ (unless (null? missing)
+ ;; 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
+ ;; OK because we have machinery that accepts both the hyphen and the
+ ;; underscore version.
+ (raise (condition
+ (&message
+ (message (format #f (G_ "you may need these modules \
in the initrd for ~a:~{ ~a~}")
- device missing)))
- (&fix-hint
- (hint (format #f (G_ "Try adding them to the
+ device missing)))
+ (&fix-hint
+ (hint (format #f (G_ "Try adding them to the
@code{initrd-modules} field of your @code{operating-system} declaration, along
these lines:
@@ -161,9 +150,9 @@ these lines:
If you think this diagnostic is inaccurate, use the @option{--skip-checks}
option of @command{guix system}.\n")
- missing)))
- (&error-location
- (location (source-properties->location location)))))))))
+ missing)))
+ (&error-location
+ (location (source-properties->location location)))))))
;;;