[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GuixSD bootable ISO-9669 image
From: |
Ludovic Courtès |
Subject: |
Re: GuixSD bootable ISO-9669 image |
Date: |
Thu, 08 Jun 2017 14:25:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Howdy,
Danny Milosavljevic <address@hidden> skribis:
> 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?
I actually use the /dev device name but you’re right, we should be using
UUIDs in this case.
> 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)))))))
LGTM! Or even:
--8<---------------cut here---------------start------------->8---
(letrec-syntax ((match-numerals
(syntax-rules ()
((_ index (name rest ...) body)
(let ((name (match:substring match index)))
(match-numerals (+ 1 index) (rest ...) body)))
((_ index () body)
body))))
(match-numerals 0 (year month day hour)
(string-append year month day)))
--8<---------------cut here---------------end--------------->8---
:-)
> And also:
>
> (define string->btrfs-uuid string->uid)
> (define string->ext2-uuid string->uid)
> (define string->ext3-uuid string->uid)
> ...
Yes, sounds reasonable.
Thanks!
Ludo’.