summary refs log tree commit diff
path: root/gnu/system
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2020-08-29 15:34:56 +0200
committerJulien Lepiller <julien@lepiller.eu>2020-08-31 16:12:16 +0200
commit036f23f053ee6bd34c6d387debb4a9166561dd02 (patch)
treee0f044c4daad297d1a2f033e1fc47cf5294ad1fe /gnu/system
parent7e90e28a156ddc25e3822b931a608890caf3efee (diff)
downloadguix-036f23f053ee6bd34c6d387debb4a9166561dd02.tar.gz
guix: system: Add `--label' option.
* guix/scripts/system.scm (%options): Add `--label'.
(system-derivation-for-action): Take a #:label key to set volume ID.
(perform-action): Take a #:label key.
(%default-options): Add default label value.
(process-action): Pass label value from command-line to perform-action.
* gnu/system/image.scm (image-with-label): New procedure.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/image.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index c1a718d607..733f2bfa8d 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -63,7 +63,8 @@
             iso9660-image
 
             find-image
-            system-image))
+            system-image
+            image-with-label))
 
 
 ;;;
@@ -407,6 +408,20 @@ used in the image. "
                                #:references-graphs ,inputs
                                #:substitutable? ,substitutable?))))
 
+(define (image-with-label base-image label)
+  "The volume ID of an ISO is the label of the first partition.  This procedure
+returns an image record where the first partition's label is set to <label>."
+  (image
+    (inherit base-image)
+    (partitions
+      (match (image-partitions base-image)
+        ((boot others ...)
+         (cons
+           (partition
+             (inherit boot)
+             (label label))
+           others))))))
+
 
 ;;
 ;; Image creation.