summary refs log tree commit diff
path: root/gnu/system/vm.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-30 23:45:42 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-30 23:46:17 +0200
commit10ace2c49eb68b55f8ef0d79d8a408798d99c207 (patch)
tree63bb073a9d8634f5f9e88fb45134a8de529e540b /gnu/system/vm.scm
parent85a83edb369dcebd1019674427dda9e6b3e2ed4b (diff)
downloadguix-10ace2c49eb68b55f8ef0d79d8a408798d99c207.tar.gz
vm: disk-image: Specify the root file system using a label.
* gnu/system/vm.scm (system-disk-image)[root-label]: New variable.
  Use it for the root file system, and pass it as #:file-system-label to
  'qemu-image'.
Diffstat (limited to 'gnu/system/vm.scm')
-rw-r--r--gnu/system/vm.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index ddc13468cc..184f2512f1 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -268,6 +268,12 @@ the image."
 system described by OS.  Said image can be copied on a USB stick as is.  When
 VOLATILE? is true, the root file system is made volatile; this is useful
 to USB sticks meant to be read-only."
+  (define root-label
+    ;; Volume name of the root file system.  Since we don't know which device
+    ;; will hold it, we use the volume name to find it (using the UUID would
+    ;; be even better, but somewhat less convenient.)
+    "gnu-disk-image")
+
   (define file-systems-to-keep
     (remove (lambda (fs)
               (string=? (file-system-mount-point fs) "/"))
@@ -283,7 +289,7 @@ to USB sticks meant to be read-only."
               ;; Force our own root file system.
               (file-systems (cons (file-system
                                     (mount-point "/")
-                                    (device "/dev/sda1")
+                                    (device root-label)
                                     (type file-system-type))
                                   file-systems-to-keep)))))
 
@@ -293,6 +299,7 @@ to USB sticks meant to be read-only."
                   #:disk-image-size disk-image-size
                   #:disk-image-format "raw"
                   #:file-system-type file-system-type
+                  #:file-system-label root-label
                   #:copy-inputs? #t
                   #:register-closures? #t
                   #:inputs `(("system" ,os-drv)