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'.
This commit is contained in:
Ludovic Courtès 2014-05-30 23:45:42 +02:00
parent 85a83edb36
commit 10ace2c49e
1 changed files with 8 additions and 1 deletions

View File

@ -268,6 +268,12 @@ the image."
system described by OS. Said image can be copied on a USB stick as is. When 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 VOLATILE? is true, the root file system is made volatile; this is useful
to USB sticks meant to be read-only." 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 (define file-systems-to-keep
(remove (lambda (fs) (remove (lambda (fs)
(string=? (file-system-mount-point 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. ;; Force our own root file system.
(file-systems (cons (file-system (file-systems (cons (file-system
(mount-point "/") (mount-point "/")
(device "/dev/sda1") (device root-label)
(type file-system-type)) (type file-system-type))
file-systems-to-keep))))) file-systems-to-keep)))))
@ -293,6 +299,7 @@ to USB sticks meant to be read-only."
#:disk-image-size disk-image-size #:disk-image-size disk-image-size
#:disk-image-format "raw" #:disk-image-format "raw"
#:file-system-type file-system-type #:file-system-type file-system-type
#:file-system-label root-label
#:copy-inputs? #t #:copy-inputs? #t
#:register-closures? #t #:register-closures? #t
#:inputs `(("system" ,os-drv) #:inputs `(("system" ,os-drv)