diff options
author | Danny Milosavljevic <dannym@scratchpost.org> | 2018-03-04 02:09:08 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-08-16 23:00:27 +0200 |
commit | 4f8b9d1a6f551697996c77b6e1741007e1f7c9cd (patch) | |
tree | b5a16a37703b4011a6c6db7a33592cdcdac23576 /gnu/build | |
parent | 268896444bed7b958add74b2e1e86ff802c5f5cb (diff) | |
download | patches-4f8b9d1a6f551697996c77b6e1741007e1f7c9cd.tar patches-4f8b9d1a6f551697996c77b6e1741007e1f7c9cd.tar.gz |
linux-modules: Add "modules.alias" writer.
* gnu/build/linux-modules.scm (write-module-alias-database): New
procedure.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/linux-modules.scm | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index c66ef97012..9b9fc0d9d8 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> +;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -48,7 +49,9 @@ device-module-aliases known-module-aliases matching-modules - missing-modules)) + missing-modules + + write-module-alias-database)) ;;; Commentary: ;;; @@ -486,4 +489,22 @@ are required to access DEVICE." (remove (cut member <> provided) modules)) '())) +(define (write-module-alias-database directory) + "Traverse the '.ko' files in DIRECTORY and create the corresponding +'modules.alias' file." + (define aliases + (map (lambda (file) + (cons (file-name->module-name file) (module-aliases file))) + (find-files directory "\\.ko$"))) + + (call-with-output-file (string-append directory "/modules.alias") + (lambda (port) + (display "# Aliases extracted from modules themselves.\n" port) + (for-each (match-lambda + ((module . aliases) + (for-each (lambda (alias) + (format port "alias ~a ~a\n" alias module)) + aliases))) + aliases)))) + ;;; linux-modules.scm ends here |