summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/build/linux-initrd.scm22
-rw-r--r--gnu/system.scm11
-rw-r--r--gnu/system/linux-initrd.scm9
-rw-r--r--gnu/system/vm.scm2
4 files changed, 28 insertions, 16 deletions
diff --git a/gnu/build/linux-initrd.scm b/gnu/build/linux-initrd.scm
index fb8a1f5b2b..3aaa06d3a0 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."
                                #:file->header cpio:file->cpio-header*)))
 
   (or (not compress?)
-      ;; Use '--no-name' so that gzip records neither a file name nor a time
-      ;; stamp in its output.
-      (and (zero? (system* gzip "--best" "--no-name" output))
-           (rename-file (string-append output ".gz")
-                        output))
+
+      ;; Gzip insists on adding a '.gz' suffix and does nothing if the input
+      ;; file already has that suffix.  Shuffle files around to placate it.
+      (let* ((gz-suffix? (string-suffix? ".gz" output))
+             (sans-gz    (if gz-suffix?
+                             (string-drop-right output 3)
+                             output)))
+        (when gz-suffix?
+          (rename-file output sans-gz))
+        ;; Use '--no-name' so that gzip records neither a file name nor a time
+        ;; stamp in its output.
+        (and (zero? (system* gzip "--best" "--no-name" sans-gz))
+             (begin
+               (unless gz-suffix?
+                 (rename-file (string-append output ".gz") output))
+               output)))
+
       output))
 
 (define (cache-compiled-file-name file)
diff --git a/gnu/system.scm b/gnu/system.scm
index 1766c8f90f..a5a8f40d66 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -870,12 +870,11 @@ hardware-related operations as necessary when booting a Linux container."
   (define make-initrd
     (operating-system-initrd os))
 
-  (let ((initrd (make-initrd boot-file-systems
-                             #:linux (operating-system-kernel os)
-                             #:linux-modules
-                             (operating-system-initrd-modules os)
-                             #:mapped-devices mapped-devices)))
-    (file-append initrd "/initrd")))
+  (make-initrd boot-file-systems
+               #:linux (operating-system-kernel os)
+               #:linux-modules
+               (operating-system-initrd-modules os)
+               #:mapped-devices mapped-devices))
 
 (define (locale-name->definition* name)
   "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 a53d3cb106..983c6d81c8 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."
             (lambda (port)
               (simple-format port "~A\n" #$guile)))
 
-          (build-initrd (string-append #$output "/initrd")
+          (build-initrd (string-append #$output "/initrd.cpio.gz")
                         #:guile #$guile
                         #:init #$init
                         ;; Copy everything INIT refers to into the initrd.
                         #:references-graphs '("closure")
                         #:gzip (string-append #$gzip "/bin/gzip")))))
 
-  (computed-file name builder
-                 #:options
-                 `(#:references-graphs (("closure" ,init)))))
+  (file-append (computed-file name builder
+                              #:options
+                              `(#:references-graphs (("closure" ,init))))
+               "/initrd.cpio.gz"))
 
 (define (flat-linux-module-directory linux modules)
   "Return a flat directory containing the Linux kernel modules listed in
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 8e310a1607..9400e6310d 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -213,7 +213,7 @@ made available under the /xchg CIFS share."
               (let* ((inputs  '#$(list qemu (canonical-package coreutils)))
                      (linux   (string-append #$linux "/"
                                              #$(system-linux-image-file-name)))
-                     (initrd  (string-append #$initrd "/initrd"))
+                     (initrd  #$initrd)
                      (loader  #$loader)
                      (graphs  '#$(match references-graphs
                                    (((graph-files . _) ...) graph-files)