vm: 'system-disk-image' no longer requires the OS to define the "/" file system.

Previously 'guix system disk-image' would fail if the OS didn't define a
"/" file system, even though it actually overrides that file system.

* gnu/system/vm.scm (system-disk-image)[root-uuid]: Turn into a
procedure.
Call 'root-uuid' on a variant of OS with a "/" file system and inherit
from that.
This commit is contained in:
Ludovic Courtès 2019-04-24 21:56:03 +02:00
parent 91a7c4998f
commit 5be7aecd14
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -617,7 +617,7 @@ (define root-label
;; Volume name of the root file system. ;; Volume name of the root file system.
(normalize-label "Guix_image")) (normalize-label "Guix_image"))
(define root-uuid (define (root-uuid os)
;; UUID of the root file system, computed in a deterministic fashion. ;; UUID of the root file system, computed in a deterministic fashion.
;; This is what we use to locate the root file system so it has to be ;; This is what we use to locate the root file system so it has to be
;; different from the user's own file system UUIDs. ;; different from the user's own file system UUIDs.
@ -647,17 +647,26 @@ (define file-systems-to-keep
(bootloader grub-mkrescue-bootloader)) (bootloader grub-mkrescue-bootloader))
(operating-system-bootloader os))) (operating-system-bootloader os)))
;; Force our own root file system. ;; Force our own root file system. (We need a "/" file system
;; to call 'root-uuid'.)
(file-systems (cons (file-system (file-systems (cons (file-system
(mount-point "/") (mount-point "/")
(device root-uuid) (device "/dev/placeholder")
(type file-system-type))
file-systems-to-keep))))
(uuid (root-uuid os))
(os (operating-system
(inherit os)
(file-systems (cons (file-system
(mount-point "/")
(device uuid)
(type file-system-type)) (type file-system-type))
file-systems-to-keep)))) file-systems-to-keep))))
(bootcfg (operating-system-bootcfg os))) (bootcfg (operating-system-bootcfg os)))
(if (string=? "iso9660" file-system-type) (if (string=? "iso9660" file-system-type)
(iso9660-image #:name name (iso9660-image #:name name
#:file-system-label root-label #:file-system-label root-label
#:file-system-uuid root-uuid #:file-system-uuid uuid
#:os os #:os os
#:register-closures? #t #:register-closures? #t
#:bootcfg-drv bootcfg #:bootcfg-drv bootcfg
@ -674,7 +683,7 @@ (define file-systems-to-keep
#: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 #:file-system-label root-label
#:file-system-uuid root-uuid #:file-system-uuid uuid
#:copy-inputs? #t #:copy-inputs? #t
#:register-closures? #t #:register-closures? #t
#:inputs `(("system" ,os) #:inputs `(("system" ,os)