summary refs log tree commit diff
path: root/gnu/system/linux-initrd.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-07-29 18:31:42 +0200
committerLudovic Courtès <ludo@gnu.org>2018-07-29 18:50:28 +0200
commitfcd068e984078ab74c6842af2525bf88096cd262 (patch)
tree01a18470cb88a13a6c9d2dbc33cd098dfa93c083 /gnu/system/linux-initrd.scm
parentd2a1cf45f74f4be67bd51068fc531a1b8ae54536 (diff)
downloadguix-fcd068e984078ab74c6842af2525bf88096cd262.tar.gz
linux-initrd: Try several file names when looking up modules.
Fixes <https://bugs.gnu.org/31714>.
Reported by Tonton <tonton@riseup.net>.

* gnu/build/linux-modules.scm (find-module-file): New procedure.
* gnu/system/linux-initrd.scm (flat-linux-module-directory)[build-exp]:
Remove 'lookup' procedure and use 'find-module-file' instead.
* gnu/system/mapped-devices.scm (check-device-initrd-modules): Add
comment.
Diffstat (limited to 'gnu/system/linux-initrd.scm')
-rw-r--r--gnu/system/linux-initrd.scm26
1 files changed, 5 insertions, 21 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index d73ebfd8d3..a5a111908f 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -108,34 +108,18 @@ the derivations referenced by EXP are automatically copied to the initrd."
 MODULES and taken from LINUX."
   (define build-exp
     (with-imported-modules (source-module-closure
-                            '((guix build utils)
-                              (gnu build linux-modules)))
+                            '((gnu build linux-modules)))
       #~(begin
-          (use-modules (ice-9 match) (ice-9 regex)
+          (use-modules (gnu build linux-modules)
                        (srfi srfi-1)
-                       (guix build utils)
-                       (gnu build linux-modules))
-
-          (define (string->regexp str)
-            ;; Return a regexp that matches STR exactly.
-            (string-append "^" (regexp-quote str) "$"))
+                       (srfi srfi-26))
 
           (define module-dir
             (string-append #$linux "/lib/modules"))
 
-          (define (lookup module)
-            (let ((name (ensure-dot-ko module)))
-              (match (find-files module-dir (string->regexp name))
-                ((file)
-                 file)
-                (()
-                 (error "module not found" name module-dir))
-                ((_ ...)
-                 (error "several modules by that name"
-                        name module-dir)))))
-
           (define modules
-            (let ((modules (map lookup '#$modules)))
+            (let* ((lookup  (cut find-module-file module-dir <>))
+                   (modules (map lookup '#$modules)))
               (append modules
                       (recursive-module-dependencies modules
                                                      #:lookup-module lookup))))