aboutsummaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-07 10:41:06 +0100
committerLudovic Courtès <ludo@gnu.org>2018-03-07 11:22:42 +0100
commitca23693d280de5c4031058da4d3041d830080484 (patch)
treeccd3a61edd11e3634895f5f2e792b306b71e586b /gnu/system
parent6c4458172d12dbda969c2eae5b3b6be19a068780 (diff)
downloadguix-ca23693d280de5c4031058da4d3041d830080484.tar.gz
guix-ca23693d280de5c4031058da4d3041d830080484.zip
linux-initrd: Factorize 'check-device-initrd-modules'.
* gnu/system/mapped-devices.scm (check-device-initrd-modules): Move to... * gnu/system/linux-initrd.scm (check-device-initrd-modules): ... here. New procedure. * po/guix/POTFILES.in: Add it. * guix/scripts/system.scm (check-initrd-modules)[check-device]: Remove. Use 'check-device-initrd-modules' instead.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/linux-initrd.scm24
-rw-r--r--gnu/system/mapped-devices.scm19
2 files changed, 25 insertions, 18 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index e0cb59c009..d75caed83e 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -24,6 +24,7 @@
#:use-module (guix store)
#:use-module (guix gexp)
#:use-module (guix utils)
+ #:use-module (guix i18n)
#:use-module ((guix store)
#:select (%store-prefix))
#:use-module ((guix derivations)
@@ -37,16 +38,22 @@
#:select (%guile-static-stripped))
#:use-module (gnu system file-systems)
#:use-module (gnu system mapped-devices)
+ #:autoload (gnu build linux-modules)
+ (device-module-aliases matching-modules)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (ice-9 vlist)
+ #:use-module (ice-9 format)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-34)
+ #:use-module (srfi srfi-35)
#:export (expression->initrd
%base-initrd-modules
raw-initrd
file-system-packages
- base-initrd))
+ base-initrd
+ check-device-initrd-modules))
;;; Commentary:
@@ -343,4 +350,19 @@ loaded at boot time in the order in which they appear."
#:volatile-root? volatile-root?
#:on-error on-error))
+(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."
+ (let ((modules (delete-duplicates
+ (append-map matching-modules
+ (device-module-aliases device)))))
+ (unless (every (cute member <> linux-modules) modules)
+ (raise (condition
+ (&message
+ (message (format #f (G_ "you may need these modules \
+in the initrd for ~a:~{ ~a~}")
+ device modules)))
+ (&error-location
+ (location (source-properties->location location))))))))
+
;;; linux-initrd.scm ends here
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index 5ceb5e658c..e6ac635231 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -29,9 +29,9 @@
#:use-module (gnu services)
#:use-module (gnu services shepherd)
#:use-module (gnu system uuid)
+ #:use-module ((gnu system linux-initrd)
+ #:select (check-device-initrd-modules))
#:autoload (gnu build file-systems) (find-partition-by-luks-uuid)
- #:autoload (gnu build linux-modules)
- (device-module-aliases matching-modules)
#:autoload (gnu packages cryptsetup) (cryptsetup-static)
#:autoload (gnu packages linux) (mdadm-static)
#:use-module (srfi srfi-1)
@@ -154,21 +154,6 @@
#~(zero? (system* #$(file-append cryptsetup-static "/sbin/cryptsetup")
"close" #$target)))
-(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."
- (let ((modules (delete-duplicates
- (append-map matching-modules
- (device-module-aliases device)))))
- (unless (every (cute member <> linux-modules) modules)
- (raise (condition
- (&message
- (message (format #f (G_ "you may need these modules \
-in the initrd for ~a:~{ ~a~}")
- device modules)))
- (&error-location
- (location (source-properties->location location))))))))
-
(define* (check-luks-device md #:key
needed-for-boot?
(initrd-modules '())