diff options
Diffstat (limited to 'gnu/system')
-rw-r--r-- | gnu/system/examples/lightweight-desktop.tmpl | 8 | ||||
-rw-r--r-- | gnu/system/file-systems.scm | 10 | ||||
-rw-r--r-- | gnu/system/linux-initrd.scm | 6 | ||||
-rw-r--r-- | gnu/system/uuid.scm | 30 |
4 files changed, 32 insertions, 22 deletions
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl index fb7cfebf6d..d13c04c76c 100644 --- a/gnu/system/examples/lightweight-desktop.tmpl +++ b/gnu/system/examples/lightweight-desktop.tmpl @@ -17,16 +17,16 @@ (bootloader grub-efi-bootloader) (target "/boot/efi"))) - ;; Assume the target root file system is labelled "my-root". + ;; Assume the target root file system is labelled "my-root", + ;; and the EFI System Partition has UUID 1234-ABCD. (file-systems (cons* (file-system (device "my-root") (title 'label) (mount-point "/") (type "ext4")) (file-system - ;; Specify partition here since FAT - ;; labels are currently unsupported. - (device "/dev/sda1") + (device (uuid "1234-ABCD" 'fat)) + (title 'uuid) (mount-point "/boot/efi") (type "vfat")) %base-file-systems)) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 92f040425d..27734e892a 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -18,6 +18,7 @@ (define-module (gnu system file-systems) #:use-module (ice-9 match) + #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (guix records) #:use-module (gnu system uuid) @@ -161,7 +162,7 @@ initrd code." (match fs (($ <file-system> device title mount-point type flags options _ _ check?) (list (if (uuid? device) - (uuid-bytevector device) + `(uuid ,(uuid-type device) ,(uuid-bytevector device)) device) title mount-point type flags options check?)))) @@ -170,7 +171,12 @@ initrd code." (match sexp ((device title mount-point type flags options check?) (file-system - (device device) (title title) + (device (match device + (('uuid (? symbol? type) (? bytevector? bv)) + (bytevector->uuid bv type)) + (_ + device))) + (title title) (mount-point mount-point) (type type) (flags flags) (options options) (check? check?))))) diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 969a89266c..948c543a15 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -187,9 +187,11 @@ to it are lost." '((gnu build linux-boot) (guix build utils) (guix build bournish) + (gnu system file-systems) (gnu build file-systems))) #~(begin (use-modules (gnu build linux-boot) + (gnu system file-systems) (guix build utils) (guix build bournish) ;add the 'bournish' meta-command (srfi srfi-26) @@ -206,7 +208,9 @@ to it are lost." (set-path-environment-variable "PATH" '("bin" "sbin") '#$helper-packages))) - (boot-system #:mounts '#$(map file-system->spec file-systems) + (boot-system #:mounts + (map spec->file-system + '#$(map file-system->spec file-systems)) #:pre-mount (lambda () (and #$@device-mapping-commands)) #:linux-modules '#$linux-modules diff --git a/gnu/system/uuid.scm b/gnu/system/uuid.scm index e422e06a6d..eaddfaed05 100644 --- a/gnu/system/uuid.scm +++ b/gnu/system/uuid.scm @@ -42,7 +42,7 @@ string->ext3-uuid string->ext4-uuid string->btrfs-uuid - string->fat32-uuid + string->fat-uuid iso9660-uuid->string ;; XXX: For lack of a better place. @@ -164,25 +164,25 @@ ISO9660 UUID representation." ;;; -;;; FAT32. +;;; FAT32/FAT16. ;;; -(define-syntax %fat32-endianness - ;; Endianness of FAT file systems. +(define-syntax %fat-endianness + ;; Endianness of FAT32/FAT16 file systems. (identifier-syntax (endianness little))) -(define (fat32-uuid->string uuid) - "Convert fat32 UUID, a 4-byte bytevector, to its string representation." - (let ((high (bytevector-uint-ref uuid 0 %fat32-endianness 2)) - (low (bytevector-uint-ref uuid 2 %fat32-endianness 2))) +(define (fat-uuid->string uuid) + "Convert FAT32/FAT16 UUID, a 4-byte bytevector, to its string representation." + (let ((high (bytevector-uint-ref uuid 0 %fat-endianness 2)) + (low (bytevector-uint-ref uuid 2 %fat-endianness 2))) (format #f "~:@(~x-~x~)" low high))) -(define %fat32-uuid-rx +(define %fat-uuid-rx (make-regexp "^([[:xdigit:]]{4})-([[:xdigit:]]{4})$")) -(define (string->fat32-uuid str) - "Parse STR, which is in FAT32 format, and return a bytevector or #f." - (match (regexp-exec %fat32-uuid-rx str) +(define (string->fat-uuid str) + "Parse STR, which is in FAT32/FAT16 format, and return a bytevector or #f." + (match (regexp-exec %fat-uuid-rx str) (#f #f) (rx-match @@ -190,7 +190,7 @@ ISO9660 UUID representation." (match:substring rx-match 2) 16) (string->number (match:substring rx-match 1) 16)) - %fat32-endianness + %fat-endianness 2)))) @@ -216,14 +216,14 @@ ISO9660 UUID representation." (define %uuid-parsers (vhashq ('dce 'ext2 'ext3 'ext4 'btrfs 'luks => string->dce-uuid) - ('fat32 'fat => string->fat32-uuid) + ('fat32 'fat16 'fat => string->fat-uuid) ('iso9660 => string->iso9660-uuid))) (define %uuid-printers (vhashq ('dce 'ext2 'ext3 'ext4 'btrfs 'luks => dce-uuid->string) ('iso9660 => iso9660-uuid->string) - ('fat32 'fat => fat32-uuid->string))) + ('fat32 'fat16 'fat => fat-uuid->string))) (define* (string->uuid str #:optional (type 'dce)) "Parse STR as a UUID of the given TYPE. On success, return the |