summary refs log tree commit diff
path: root/gnu/build/vm.scm
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2017-07-03 10:05:03 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2017-07-03 10:07:59 +0200
commitbe1033a3349069ee722bf25c804b3bfee4467886 (patch)
tree153668a59cd5833b7fac3e955074446789af53c3 /gnu/build/vm.scm
parent1b0f266e40aead09be95a984bd9c6cec3dff397e (diff)
downloadguix-be1033a3349069ee722bf25c804b3bfee4467886.tar.gz
build: Add iso9660 system image generator.
* build-aux/hydra/gnu-system.scm (qemu-jobs): Add 'iso9660-image .
* gnu/build/vm.scm (make-iso9660-image): New variable.  Export it.
* gnu/system/vm.scm (iso9660-image): New variable.  Use make-iso9660-image.
(system-disk-image): Use iso9660-image.
Diffstat (limited to 'gnu/build/vm.scm')
-rw-r--r--gnu/build/vm.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 8f7fc3c9c4..860c98346d 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -50,7 +50,8 @@
             estimated-partition-size
             root-partition-initializer
             initialize-partition-table
-            initialize-hard-disk))
+            initialize-hard-disk
+            make-iso9660-image))
 
 ;;; Commentary:
 ;;;
@@ -351,6 +352,21 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
                             (string-append "boot/grub/grub.cfg=" config-file)))
       (error "failed to create GRUB EFI image"))))
 
+(define* (make-iso9660-image grub config-file os-drv target
+                             #:key (volume-id "GuixSD"))
+  "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
+Grub configuration and OS-DRV as the stuff in it."
+  (let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
+    (mkdir-p "/tmp/root/var/run")
+    (mkdir-p "/tmp/root/run")
+    (unless (zero? (system* grub-mkrescue "-o" target
+                            (string-append "boot/grub/grub.cfg=" config-file)
+                            (string-append "gnu/store=" os-drv "/..")
+                            "var=/tmp/root/var"
+                            "run=/tmp/root/run"
+                            "--" "-volid" (string-upcase volume-id)))
+      (error "failed to create ISO image"))))
+
 (define* (initialize-hard-disk device
                                #:key
                                bootloader-package