diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-05-22 22:30:13 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-05-22 23:24:13 +0200 |
commit | c4a74364b9ddb5c34bce788d453f93aa307731dd (patch) | |
tree | c9fc06ad5f46ce90184ec3018ec727da24f1ded1 /guix/build/vm.scm | |
parent | 3035b50f28c1bcbc0a2bb09457a69ea9c06d69e0 (diff) |
vm: Make the image format a parameter.
* guix/build/vm.scm (load-in-linux-vm): Add #:disk-image-format
parameter; add 'image-file' variable. Honor DISK-IMAGE-FORMAT.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Add
#:disk-image-format parameter, and honor it.
(qemu-image): Likewise.
Diffstat (limited to 'guix/build/vm.scm')
-rw-r--r-- | guix/build/vm.scm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/guix/build/vm.scm b/guix/build/vm.scm index 2a8843c633..4de536abb4 100644 --- a/guix/build/vm.scm +++ b/guix/build/vm.scm @@ -50,6 +50,7 @@ (qemu (qemu-command)) (memory-size 512) linux initrd make-disk-image? (disk-image-size 100) + (disk-image-format "qcow2") (references-graphs '())) "Run BUILDER, a Scheme file, into a VM running LINUX with INITRD, and copy the result to OUTPUT. @@ -60,9 +61,12 @@ it via /dev/hda. REFERENCES-GRAPHS can specify a list of reference-graph files as produced by the #:references-graphs parameter of 'derivation'." + (define image-file + (string-append "image." disk-image-format)) (when make-disk-image? - (unless (zero? (system* "qemu-img" "create" "-f" "qcow2" "image.qcow2" + (unless (zero? (system* "qemu-img" "create" "-f" disk-image-format + image-file (number->string disk-image-size))) (error "qemu-img failed"))) @@ -92,12 +96,12 @@ the #:references-graphs parameter of 'derivation'." "-append" (string-append "console=ttyS0 --load=" builder) (if make-disk-image? - '("-hda" "image.qcow2") + `("-hda" ,image-file) '()))) (error "qemu failed" qemu)) (if make-disk-image? - (copy-file "image.qcow2" output) + (copy-file image-file output) (begin (mkdir output) (copy-recursively "xchg" output)))) |