diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-03-15 23:41:31 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-03-15 23:46:16 +0100 |
| commit | 8ab10c19d72caab7459034a6e72b0117d7c5cec8 (patch) | |
| tree | 35ab14d1f7f1514ab906580bd871a3409180e26e /gnu/system | |
| parent | d661ed521eedf4663c57e5d96e409a32a52113e0 (diff) | |
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.
Diffstat (limited to 'gnu/system')
| -rw-r--r-- | gnu/system/linux-initrd.scm | 46 | ||||
| -rw-r--r-- | gnu/system/mapped-devices.scm | 49 |
2 files changed, 48 insertions, 47 deletions
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 410484390c5..e0cb59c0098 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #:use-module (guix store) | 24 | #:use-module (guix store) |
| 25 | #:use-module (guix gexp) | 25 | #:use-module (guix gexp) |
| 26 | #:use-module (guix utils) | 26 | #:use-module (guix utils) |
| 27 | #:use-module (guix i18n) | ||
| 28 | #:use-module ((guix store) | 27 | #:use-module ((guix store) |
| 29 | #:select (%store-prefix)) | 28 | #:select (%store-prefix)) |
| 30 | #:use-module ((guix derivations) | 29 | #:use-module ((guix derivations) |
| @@ -38,22 +37,16 @@ | |||
| 38 | #:select (%guile-static-stripped)) | 37 | #:select (%guile-static-stripped)) |
| 39 | #:use-module (gnu system file-systems) | 38 | #:use-module (gnu system file-systems) |
| 40 | #:use-module (gnu system mapped-devices) | 39 | #:use-module (gnu system mapped-devices) |
| 41 | #:autoload (gnu build linux-modules) | ||
| 42 | (device-module-aliases matching-modules known-module-aliases) | ||
| 43 | #:use-module (ice-9 match) | 40 | #:use-module (ice-9 match) |
| 44 | #:use-module (ice-9 regex) | 41 | #:use-module (ice-9 regex) |
| 45 | #:use-module (ice-9 vlist) | 42 | #:use-module (ice-9 vlist) |
| 46 | #:use-module (ice-9 format) | ||
| 47 | #:use-module (srfi srfi-1) | 43 | #:use-module (srfi srfi-1) |
| 48 | #:use-module (srfi srfi-26) | 44 | #:use-module (srfi srfi-26) |
| 49 | #:use-module (srfi srfi-34) | ||
| 50 | #:use-module (srfi srfi-35) | ||
| 51 | #:export (expression->initrd | 45 | #:export (expression->initrd |
| 52 | %base-initrd-modules | 46 | %base-initrd-modules |
| 53 | raw-initrd | 47 | raw-initrd |
| 54 | file-system-packages | 48 | file-system-packages |
| 55 | base-initrd | 49 | base-initrd)) |
| 56 | check-device-initrd-modules)) | ||
| 57 | 50 | ||
| 58 | 51 | ||
| 59 | ;;; Commentary: | 52 | ;;; Commentary: |
| @@ -350,41 +343,4 @@ loaded at boot time in the order in which they appear." | |||
| 350 | #:volatile-root? volatile-root? | 343 | #:volatile-root? volatile-root? |
| 351 | #:on-error on-error)) | 344 | #:on-error on-error)) |
| 352 | 345 | ||
| 353 | (define (check-device-initrd-modules device linux-modules location) | ||
| 354 | "Raise an error if DEVICE needs modules beyond LINUX-MODULES to operate. | ||
| 355 | DEVICE must be a \"/dev\" file name." | ||
| 356 | (define aliases | ||
| 357 | ;; Attempt to load 'modules.alias' from the current kernel, assuming we're | ||
| 358 | ;; on GuixSD, and assuming that corresponds to the kernel we'll be | ||
| 359 | ;; installing. Skip the whole thing if that file cannot be read. | ||
| 360 | (catch 'system-error | ||
| 361 | (lambda () | ||
| 362 | (known-module-aliases)) | ||
| 363 | (const #f))) | ||
| 364 | |||
| 365 | (when aliases | ||
| 366 | (let ((modules (delete-duplicates | ||
| 367 | (append-map (cut matching-modules <> aliases) | ||
| 368 | (device-module-aliases device))))) | ||
| 369 | (unless (every (cute member <> linux-modules) modules) | ||
| 370 | (raise (condition | ||
| 371 | (&message | ||
| 372 | (message (format #f (G_ "you may need these modules \ | ||
| 373 | in the initrd for ~a:~{ ~a~}") | ||
| 374 | device modules))) | ||
| 375 | (&fix-hint | ||
| 376 | (hint (format #f (G_ "Try adding them to the | ||
| 377 | @code{initrd-modules} field of your @code{operating-system} declaration, along | ||
| 378 | these lines: | ||
| 379 | |||
| 380 | @example | ||
| 381 | (operating-system | ||
| 382 | ;; @dots{} | ||
| 383 | (initrd-modules (append (list~{ ~s~}) | ||
| 384 | %base-initrd-modules))) | ||
| 385 | @end example\n") | ||
| 386 | modules))) | ||
| 387 | (&error-location | ||
| 388 | (location (source-properties->location location))))))))) | ||
| 389 | |||
| 390 | ;;; linux-initrd.scm ends here | 346 | ;;; linux-initrd.scm ends here |
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index e6ac6352314..279d521cac5 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm | |||
| @@ -25,13 +25,14 @@ | |||
| 25 | #:use-module (guix i18n) | 25 | #:use-module (guix i18n) |
| 26 | #:use-module ((guix utils) | 26 | #:use-module ((guix utils) |
| 27 | #:select (source-properties->location | 27 | #:select (source-properties->location |
| 28 | &fix-hint | ||
| 28 | &error-location)) | 29 | &error-location)) |
| 29 | #:use-module (gnu services) | 30 | #:use-module (gnu services) |
| 30 | #:use-module (gnu services shepherd) | 31 | #:use-module (gnu services shepherd) |
| 31 | #:use-module (gnu system uuid) | 32 | #:use-module (gnu system uuid) |
| 32 | #:use-module ((gnu system linux-initrd) | ||
| 33 | #:select (check-device-initrd-modules)) | ||
| 34 | #:autoload (gnu build file-systems) (find-partition-by-luks-uuid) | 33 | #:autoload (gnu build file-systems) (find-partition-by-luks-uuid) |
| 34 | #:autoload (gnu build linux-modules) | ||
| 35 | (device-module-aliases matching-modules) | ||
| 35 | #:autoload (gnu packages cryptsetup) (cryptsetup-static) | 36 | #:autoload (gnu packages cryptsetup) (cryptsetup-static) |
| 36 | #:autoload (gnu packages linux) (mdadm-static) | 37 | #:autoload (gnu packages linux) (mdadm-static) |
| 37 | #:use-module (srfi srfi-1) | 38 | #:use-module (srfi srfi-1) |
| @@ -55,6 +56,8 @@ | |||
| 55 | device-mapping-service-type | 56 | device-mapping-service-type |
| 56 | device-mapping-service | 57 | device-mapping-service |
| 57 | 58 | ||
| 59 | check-device-initrd-modules ;XXX: needs a better place | ||
| 60 | |||
| 58 | luks-device-mapping | 61 | luks-device-mapping |
| 59 | raid-device-mapping)) | 62 | raid-device-mapping)) |
| 60 | 63 | ||
| @@ -108,6 +111,48 @@ | |||
| 108 | 111 | ||
| 109 | 112 | ||
| 110 | ;;; | 113 | ;;; |
| 114 | ;;; Static checks. | ||
| 115 | ;;; | ||
| 116 | |||
| 117 | (define (check-device-initrd-modules device linux-modules location) | ||
| 118 | "Raise an error if DEVICE needs modules beyond LINUX-MODULES to operate. | ||
| 119 | DEVICE must be a \"/dev\" file name." | ||
| 120 | (define aliases | ||
| 121 | ;; Attempt to load 'modules.alias' from the current kernel, assuming we're | ||
| 122 | ;; on GuixSD, and assuming that corresponds to the kernel we'll be | ||
| 123 | ;; installing. Skip the whole thing if that file cannot be read. | ||
| 124 | (catch 'system-error | ||
| 125 | (lambda () | ||
| 126 | (known-module-aliases)) | ||
| 127 | (const #f))) | ||
| 128 | |||
| 129 | (when aliases | ||
| 130 | (let ((modules (delete-duplicates | ||
| 131 | (append-map (cut matching-modules <> aliases) | ||
| 132 | (device-module-aliases device))))) | ||
| 133 | (unless (every (cute member <> linux-modules) modules) | ||
| 134 | (raise (condition | ||
| 135 | (&message | ||
| 136 | (message (format #f (G_ "you may need these modules \ | ||
| 137 | in the initrd for ~a:~{ ~a~}") | ||
| 138 | device modules))) | ||
| 139 | (&fix-hint | ||
| 140 | (hint (format #f (G_ "Try adding them to the | ||
| 141 | @code{initrd-modules} field of your @code{operating-system} declaration, along | ||
| 142 | these lines: | ||
| 143 | |||
| 144 | @example | ||
| 145 | (operating-system | ||
| 146 | ;; @dots{} | ||
| 147 | (initrd-modules (append (list~{ ~s~}) | ||
| 148 | %base-initrd-modules))) | ||
| 149 | @end example\n") | ||
| 150 | modules))) | ||
| 151 | (&error-location | ||
| 152 | (location (source-properties->location location))))))))) | ||
| 153 | |||
| 154 | |||
| 155 | ;;; | ||
| 111 | ;;; Common device mappings. | 156 | ;;; Common device mappings. |
| 112 | ;;; | 157 | ;;; |
| 113 | 158 | ||
