diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-11-21 16:19:09 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-11-21 23:26:59 +0100 |
| commit | d422cbb3d6a1cc7e4553a2335b113475a05d68ad (patch) | |
| tree | fce053b15b69cd3512187208302d2c72c9c77dbc /gnu | |
| parent | a29ce1f97dc8336e5a063f14d98d673b33b4bff4 (diff) | |
linux-initrd: 'expression->initrd' returns the complete file name.
Previously 'expression->initrd' would return the directory that contains
the 'initrd' file; now it returns the complete file name for that file.
* gnu/system/linux-initrd.scm (expression->initrd)[builder]: Change
output file name to "initrd.cpio.gz". Tail-call 'file-append' to return
the complete file name.
* gnu/system.scm (operating-system-initrd-file): Remove 'file-append'
call.
* gnu/build/linux-initrd.scm (write-cpio-archive): Check whether OUTPUT
already has the ".gz" suffix; rename if before invoking GZIP if it does,
and otherwise after.
* gnu/system/vm.scm (expression->derivation-in-linux-vm)[builder]: Do
not append "/initrd" to #$initrd.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/build/linux-initrd.scm | 22 | ||||
| -rw-r--r-- | gnu/system.scm | 11 | ||||
| -rw-r--r-- | gnu/system/linux-initrd.scm | 9 | ||||
| -rw-r--r-- | gnu/system/vm.scm | 2 |
4 files changed, 28 insertions, 16 deletions
diff --git a/gnu/build/linux-initrd.scm b/gnu/build/linux-initrd.scm index fb8a1f5b2bd..3aaa06d3a0a 100644 --- a/gnu/build/linux-initrd.scm +++ b/gnu/build/linux-initrd.scm | |||
| @@ -72,11 +72,23 @@ COMPRESS? is true, compress it using GZIP. On success, return OUTPUT." | |||
| 72 | #:file->header cpio:file->cpio-header*))) | 72 | #:file->header cpio:file->cpio-header*))) |
| 73 | 73 | ||
| 74 | (or (not compress?) | 74 | (or (not compress?) |
| 75 | ;; Use '--no-name' so that gzip records neither a file name nor a time | 75 | |
| 76 | ;; stamp in its output. | 76 | ;; Gzip insists on adding a '.gz' suffix and does nothing if the input |
| 77 | (and (zero? (system* gzip "--best" "--no-name" output)) | 77 | ;; file already has that suffix. Shuffle files around to placate it. |
| 78 | (rename-file (string-append output ".gz") | 78 | (let* ((gz-suffix? (string-suffix? ".gz" output)) |
| 79 | output)) | 79 | (sans-gz (if gz-suffix? |
| 80 | (string-drop-right output 3) | ||
| 81 | output))) | ||
| 82 | (when gz-suffix? | ||
| 83 | (rename-file output sans-gz)) | ||
| 84 | ;; Use '--no-name' so that gzip records neither a file name nor a time | ||
| 85 | ;; stamp in its output. | ||
| 86 | (and (zero? (system* gzip "--best" "--no-name" sans-gz)) | ||
| 87 | (begin | ||
| 88 | (unless gz-suffix? | ||
| 89 | (rename-file (string-append output ".gz") output)) | ||
| 90 | output))) | ||
| 91 | |||
| 80 | output)) | 92 | output)) |
| 81 | 93 | ||
| 82 | (define (cache-compiled-file-name file) | 94 | (define (cache-compiled-file-name file) |
diff --git a/gnu/system.scm b/gnu/system.scm index 1766c8f90f6..a5a8f40d666 100644 --- a/gnu/system.scm +++ b/gnu/system.scm | |||
| @@ -870,12 +870,11 @@ hardware-related operations as necessary when booting a Linux container." | |||
| 870 | (define make-initrd | 870 | (define make-initrd |
| 871 | (operating-system-initrd os)) | 871 | (operating-system-initrd os)) |
| 872 | 872 | ||
| 873 | (let ((initrd (make-initrd boot-file-systems | 873 | (make-initrd boot-file-systems |
| 874 | #:linux (operating-system-kernel os) | 874 | #:linux (operating-system-kernel os) |
| 875 | #:linux-modules | 875 | #:linux-modules |
| 876 | (operating-system-initrd-modules os) | 876 | (operating-system-initrd-modules os) |
| 877 | #:mapped-devices mapped-devices))) | 877 | #:mapped-devices mapped-devices)) |
| 878 | (file-append initrd "/initrd"))) | ||
| 879 | 878 | ||
| 880 | (define (locale-name->definition* name) | 879 | (define (locale-name->definition* name) |
| 881 | "Variant of 'locale-name->definition' that raises an error upon failure." | 880 | "Variant of 'locale-name->definition' that raises an error upon failure." |
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index a53d3cb106c..983c6d81c86 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm | |||
| @@ -91,16 +91,17 @@ the derivations referenced by EXP are automatically copied to the initrd." | |||
| 91 | (lambda (port) | 91 | (lambda (port) |
| 92 | (simple-format port "~A\n" #$guile))) | 92 | (simple-format port "~A\n" #$guile))) |
| 93 | 93 | ||
| 94 | (build-initrd (string-append #$output "/initrd") | 94 | (build-initrd (string-append #$output "/initrd.cpio.gz") |
| 95 | #:guile #$guile | 95 | #:guile #$guile |
| 96 | #:init #$init | 96 | #:init #$init |
| 97 | ;; Copy everything INIT refers to into the initrd. | 97 | ;; Copy everything INIT refers to into the initrd. |
| 98 | #:references-graphs '("closure") | 98 | #:references-graphs '("closure") |
| 99 | #:gzip (string-append #$gzip "/bin/gzip"))))) | 99 | #:gzip (string-append #$gzip "/bin/gzip"))))) |
| 100 | 100 | ||
| 101 | (computed-file name builder | 101 | (file-append (computed-file name builder |
| 102 | #:options | 102 | #:options |
| 103 | `(#:references-graphs (("closure" ,init))))) | 103 | `(#:references-graphs (("closure" ,init)))) |
| 104 | "/initrd.cpio.gz")) | ||
| 104 | 105 | ||
| 105 | (define (flat-linux-module-directory linux modules) | 106 | (define (flat-linux-module-directory linux modules) |
| 106 | "Return a flat directory containing the Linux kernel modules listed in | 107 | "Return a flat directory containing the Linux kernel modules listed in |
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 8e310a1607a..9400e6310df 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm | |||
| @@ -213,7 +213,7 @@ made available under the /xchg CIFS share." | |||
| 213 | (let* ((inputs '#$(list qemu (canonical-package coreutils))) | 213 | (let* ((inputs '#$(list qemu (canonical-package coreutils))) |
| 214 | (linux (string-append #$linux "/" | 214 | (linux (string-append #$linux "/" |
| 215 | #$(system-linux-image-file-name))) | 215 | #$(system-linux-image-file-name))) |
| 216 | (initrd (string-append #$initrd "/initrd")) | 216 | (initrd #$initrd) |
| 217 | (loader #$loader) | 217 | (loader #$loader) |
| 218 | (graphs '#$(match references-graphs | 218 | (graphs '#$(match references-graphs |
| 219 | (((graph-files . _) ...) graph-files) | 219 | (((graph-files . _) ...) graph-files) |
