guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GuixSD bootable ISO-9669 image


From: Danny Milosavljevic
Subject: Re: GuixSD bootable ISO-9669 image
Date: Tue, 6 Jun 2017 11:35:19 +0200

On Tue, 16 May 2017 10:31:36 +0200
address@hidden (Ludovic Courtès) wrote:
> Honestly, I was under the assumptions that DCE UUIDs was all that
> mattered: it works for ext2 and btrfs, right?  I would think that people
> would rarely add FAT32 or ISO9660 UUIDs to the OS config.  

With UEFI I thought that everyone has at least one FAT32 UUID in the OS config?

What's more, just by checking /dev/disk/by-uuid the user wouldn't know what 
kind of filesystem it is.  But he had to specify the file system type in the 
config anyway - so it would be no worse than before.  Okay then.

What do you all think of the following?

(define %iso9660-uuid-rx
  ;;                   Y                m                d                H     
           M                S                ss
  (make-regexp 
"^([[:digit:]]{4})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})$"))

(define (string->iso9660-uuid str)
  "Parse STR as a ISO9660 UUID (which is really a timestamp - see 
/dev/disk/by-uuid).
Return its contents as a 16-byte bytevector.  Return #f if STR is not a valid
ISO9660 UUID representation."
  (and=> (regexp-exec %iso9660-uuid-rx str)
         (lambda (match)
           (letrec-syntax ((match-numeral
                            (syntax-rules ()
                              ((_ index)
                               (match:substring match index)))))
             (let ((year (match-numeral 1))
                   (month (match-numeral 2))
                   (day (match-numeral 3))
                   (hour (match-numeral 4))
                   (minute (match-numeral 5))
                   (second (match-numeral 6))
                   (hundredths (match-numeral 7)))
               (string->utf8 (string-append year
                                            month
                                            day
                                            hour
                                            minute
                                            second
                                            hundredths)))))))

And also:

(define string->btrfs-uuid string->uid)
(define string->ext2-uuid string->uid)
(define string->ext3-uuid string->uid)
...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]