aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-15 23:41:31 +0100
committerLudovic Courtès <ludo@gnu.org>2018-03-15 23:46:16 +0100
commit8ab10c19d72caab7459034a6e72b0117d7c5cec8 (patch)
tree35ab14d1f7f1514ab906580bd871a3409180e26e
parentd661ed521eedf4663c57e5d96e409a32a52113e0 (diff)
downloadguix-8ab10c19d72caab7459034a6e72b0117d7c5cec8.tar
guix-8ab10c19d72caab7459034a6e72b0117d7c5cec8.tar.gz
linux-initrd: Move 'check-device-initrd-modules' elsewhere.
This mostly reverts ca23693d280de5c4031058da4d3041d830080484, which introduced a circular dependency between (gnu system linux-initrd) and (gnu system mapped-devices). Reported by Eric Bavier. * gnu/system/linux-initrd.scm (check-device-initrd-modules): Move to... * gnu/system/mapped-devices.scm (check-device-initrd-modules): ... here. * po/guix/POTFILES.in: Adjust accordingly.
-rw-r--r--gnu/system/linux-initrd.scm46
-rw-r--r--gnu/system/mapped-devices.scm49
-rw-r--r--po/guix/POTFILES.in2
3 files changed, 49 insertions, 48 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 410484390c..e0cb59c009 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -24,7 +24,6 @@
#: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)
@@ -38,22 +37,16 @@
#: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 known-module-aliases)
#: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
- check-device-initrd-modules))
+ base-initrd))
;;; Commentary:
@@ -350,41 +343,4 @@ 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."
- (define aliases
- ;; Attempt to load 'modules.alias' from the current kernel, assuming we're
- ;; on GuixSD, and assuming that corresponds to the kernel we'll be
- ;; installing. Skip the whole thing if that file cannot be read.
- (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)))))
- (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)))
- (&fix-hint
- (hint (format #f (G_ "Try adding them to the
-@code{initrd-modules} field of your @code{operating-system} declaration, along
-these lines:
-
-@example
- (operating-system
- ;; @dots{}
- (initrd-modules (append (list~{ ~s~})
- %base-initrd-modules)))
-@end example\n")
- 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 e6ac635231..279d521cac 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -25,13 +25,14 @@
#:use-module (guix i18n)
#:use-module ((guix utils)
#:select (source-properties->location
+ &fix-hint
&error-location))
#: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)
@@ -55,6 +56,8 @@
device-mapping-service-type
device-mapping-service
+ check-device-initrd-modules ;XXX: needs a better place
+
luks-device-mapping
raid-device-mapping))
@@ -108,6 +111,48 @@
;;;
+;;; Static checks.
+;;;
+
+(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 GuixSD, and assuming that corresponds to the kernel we'll be
+ ;; installing. Skip the whole thing if that file cannot be read.
+ (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)))))
+ (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)))
+ (&fix-hint
+ (hint (format #f (G_ "Try adding them to the
+@code{initrd-modules} field of your @code{operating-system} declaration, along
+these lines:
+
+@example
+ (operating-system
+ ;; @dots{}
+ (initrd-modules (append (list~{ ~s~})
+ %base-initrd-modules)))
+@end example\n")
+ modules)))
+ (&error-location
+ (location (source-properties->location location)))))))))
+
+
+;;;
;;; Common device mappings.
;;;
diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in
index ba09605375..d11f408d42 100644
--- a/po/guix/POTFILES.in
+++ b/po/guix/POTFILES.in
@@ -5,7 +5,7 @@ gnu/packages.scm
gnu/services.scm
gnu/system.scm
gnu/services/shepherd.scm
-gnu/system/linux-initrd.scm
+gnu/system/mapped-devices.scm
gnu/system/shadow.scm
guix/scripts.scm
guix/scripts/build.scm