aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-29 23:07:43 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-29 23:32:46 +0200
commitef9fc40dda0f14366d0612bcb940f4fe7285e786 (patch)
treee1c24da7781b18732c2fad12516024aec498a355 /guix
parentff0bf0aca579555400faad3814c2a635dd00caf0 (diff)
downloadgnu-guix-ef9fc40dda0f14366d0612bcb940f4fe7285e786.tar
gnu-guix-ef9fc40dda0f14366d0612bcb940f4fe7285e786.tar.gz
vm: Allow a volume name to be specified for the root partition.
* guix/build/vm.scm (format-partition): Add #:label parameter, and honor it. (initialize-hard-disk): Add #:file-system-label parameter, and pass it to 'format-partition'. * gnu/system/vm.scm (qemu-image): Add #:file-system-label parameter and pass it to 'initialize-hard-disk'.
Diffstat (limited to 'guix')
-rw-r--r--guix/build/vm.scm25
1 files changed, 17 insertions, 8 deletions
diff --git a/guix/build/vm.scm b/guix/build/vm.scm
index e559542f0a..c1deb35664 100644
--- a/guix/build/vm.scm
+++ b/guix/build/vm.scm
@@ -158,10 +158,16 @@ REFERENCE-GRAPHS, a list of reference-graph files."
(define MS_BIND 4096) ; <sys/mounts.h> again!
-(define (format-partition partition type)
- "Create a file system TYPE on PARTITION."
+(define* (format-partition partition type
+ #:key label)
+ "Create a file system TYPE on PARTITION. If LABEL is true, use that as the
+volume name."
(format #t "creating ~a partition...\n" type)
- (unless (zero? (system* (string-append "mkfs." type) "-F" partition))
+ (unless (zero? (apply system* (string-append "mkfs." type)
+ "-F" partition
+ (if label
+ `("-L" ,label)
+ '())))
(error "failed to create partition")))
(define* (initialize-root-partition target-directory
@@ -204,13 +210,15 @@ REFERENCE-GRAPHS, a list of reference-graph files."
grub.cfg
disk-image-size
(file-system-type "ext4")
+ file-system-label
(closures '())
copy-closures?
(register-closures? #t))
- "Initialize DEVICE, a disk of DISK-IMAGE-SIZE bytes, with a
-FILE-SYSTEM-TYPE partition, and with GRUB installed. If REGISTER-CLOSURES? is
-true, register all of CLOSURES is the partition's store. If COPY-CLOSURES? is
-true, copy all of CLOSURES to the partition."
+ "Initialize DEVICE, a disk of DISK-IMAGE-SIZE bytes, with a FILE-SYSTEM-TYPE
+partition with (optionally) FILE-SYSTEM-LABEL as its volume name, and with
+GRUB installed. If REGISTER-CLOSURES? is true, register all of CLOSURES is
+the partition's store. If COPY-CLOSURES? is true, copy all of CLOSURES to the
+partition."
(define target-directory
"/fs")
@@ -220,7 +228,8 @@ true, copy all of CLOSURES to the partition."
(initialize-partition-table device
(- disk-image-size (* 5 (expt 2 20))))
- (format-partition partition file-system-type)
+ (format-partition partition file-system-type
+ #:label file-system-label)
(display "mounting partition...\n")
(mkdir target-directory)