summary refs log tree commit diff
path: root/gnu/build/image.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build/image.scm')
-rw-r--r--gnu/build/image.scm16
1 files changed, 13 insertions, 3 deletions
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index d8efa73f16..8a2d0eb5fd 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -37,6 +37,7 @@
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
   #:export (make-partition-image
+            convert-disk-image
             genimage
             initialize-efi-partition
             initialize-root-partition
@@ -120,13 +121,22 @@ ROOT directory to populate the image."
       (format (current-error-port)
               "Unsupported partition type~%.")))))
 
-(define* (genimage config target)
+(define (convert-disk-image image format output)
+  "Convert IMAGE to OUTPUT according to the given FORMAT."
+  (case format
+    ((compressed-qcow2)
+     (begin
+       (invoke "qemu-img" "convert" "-c" "-f" "raw"
+               "-O" "qcow2" image output)))
+    (else
+     (copy-file image output))))
+
+(define* (genimage config)
   "Use genimage to generate in TARGET directory, the image described in the
 given CONFIG file."
   ;; genimage needs a 'root' directory.
   (mkdir "root")
-  (invoke "genimage" "--config" config
-          "--outputpath" target))
+  (invoke "genimage" "--config" config))
 
 (define* (register-closure prefix closure
                            #:key