build: Allow specifying volume-uuid with make-iso9660-image.
* gnu/build/file-systems.scm (iso9660-uuid->string): Export. * gnu/build/vm.scm (make-iso9660-image): Add volume-uuid.
This commit is contained in:
		
							parent
							
								
									1ec0c1f30e
								
							
						
					
					
						commit
						1feb3076cb
					
				
					 2 changed files with 15 additions and 5 deletions
				
			
		| 
						 | 
					@ -48,6 +48,7 @@
 | 
				
			||||||
            string->ext3-uuid
 | 
					            string->ext3-uuid
 | 
				
			||||||
            string->ext4-uuid
 | 
					            string->ext4-uuid
 | 
				
			||||||
            string->btrfs-uuid
 | 
					            string->btrfs-uuid
 | 
				
			||||||
 | 
					            iso9660-uuid->string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            bind-mount
 | 
					            bind-mount
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -353,18 +353,27 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
 | 
				
			||||||
      (error "failed to create GRUB EFI image"))))
 | 
					      (error "failed to create GRUB EFI image"))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define* (make-iso9660-image grub config-file os-drv target
 | 
					(define* (make-iso9660-image grub config-file os-drv target
 | 
				
			||||||
                             #:key (volume-id "GuixSD"))
 | 
					                             #:key (volume-id "GuixSD") (volume-uuid #f))
 | 
				
			||||||
  "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
 | 
					  "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
 | 
				
			||||||
Grub configuration and OS-DRV as the stuff in it."
 | 
					Grub configuration and OS-DRV as the stuff in it."
 | 
				
			||||||
  (let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
 | 
					  (let ((grub-mkrescue (string-append grub "/bin/grub-mkrescue")))
 | 
				
			||||||
    (mkdir-p "/tmp/root/var/run")
 | 
					    (mkdir-p "/tmp/root/var/run")
 | 
				
			||||||
    (mkdir-p "/tmp/root/run")
 | 
					    (mkdir-p "/tmp/root/run")
 | 
				
			||||||
    (unless (zero? (system* grub-mkrescue "-o" target
 | 
					    (unless (zero? (apply system*
 | 
				
			||||||
                            (string-append "boot/grub/grub.cfg=" config-file)
 | 
					                          `(,grub-mkrescue "-o" ,target
 | 
				
			||||||
                            (string-append "gnu/store=" os-drv "/..")
 | 
					                            ,(string-append "boot/grub/grub.cfg=" config-file)
 | 
				
			||||||
 | 
					                            ,(string-append "gnu/store=" os-drv "/..")
 | 
				
			||||||
                            "var=/tmp/root/var"
 | 
					                            "var=/tmp/root/var"
 | 
				
			||||||
                            "run=/tmp/root/run"
 | 
					                            "run=/tmp/root/run"
 | 
				
			||||||
                            "--" "-volid" (string-upcase volume-id)))
 | 
					                            "--"
 | 
				
			||||||
 | 
					                            "-volid" ,(string-upcase volume-id)
 | 
				
			||||||
 | 
					                            ,@(if volume-uuid
 | 
				
			||||||
 | 
					                                  `("-volume_date" "uuid"
 | 
				
			||||||
 | 
					                                    ,(string-filter (lambda (value)
 | 
				
			||||||
 | 
					                                                      (not (char=? #\- value)))
 | 
				
			||||||
 | 
					                                                    (iso9660-uuid->string
 | 
				
			||||||
 | 
					                                                     volume-uuid)))
 | 
				
			||||||
 | 
					                                  `()))))
 | 
				
			||||||
      (error "failed to create ISO image"))))
 | 
					      (error "failed to create ISO image"))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define* (initialize-hard-disk device
 | 
					(define* (initialize-hard-disk device
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue