Aleksandr Vityazev wrote 2 years ago
(address . guix-patches@gnu.org)
* gnu/image.scm (<partition>)[type-uuid]: New field,
(partition-type-uuid): new exported procedure.
* gnu/system/image.scm (partition->dos-type, partition->gpt-type):
Adapt accordingly.
* doc/guix.texi (partition Reference): Document it.
---
doc/guix.texi | 5 +++++
gnu/image.scm | 4 ++++
gnu/system/image.scm | 9 +++++++--
3 files changed, 16 insertions(+), 2 deletions(-)
Toggle diff (91 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index adb1975935..7e42fcd0fc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43834,6 +43834,11 @@ The partition UUID as an @code{uuid} record (@pxref{File Systems}). By
default it is @code{#false}, which means that the partition creation
tool will attribute a random UUID to the partition.
+@item @code{type-uuid} (default: @code{#false})
+The partition type UUID as an @code{uuid} record. By default it is
+@code{#false}, which means the type UUID will be defined according to
+@code{flags} or @code{file-system}.
+
@item @code{flags} (default: @code{'()})
The partition flags as a list of symbols. Possible values are
@code{'boot} and @code{'esp}. The @code{'boot} flags should be set if
diff --git a/gnu/image.scm b/gnu/image.scm
index 523653dd77..be8b725d37 100644
--- a/gnu/image.scm
+++ b/gnu/image.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020, 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;; Copyright © 2023 Aleksandr Vityazev <avityazew@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -33,6 +34,7 @@ (define-module (gnu image)
partition-file-system-options
partition-label
partition-uuid
+ partition-type-uuid
partition-flags
partition-initializer
@@ -126,6 +128,8 @@ (define-record-type* <partition> partition make-partition
(label partition-label) ;string
(uuid partition-uuid
(default #false)) ;<uuid>
+ (type-uuid partition-type-uuid ;<uuid>
+ (default #false))
(flags partition-flags
(default '()) ;list of symbols
(sanitize validate-partition-flags))
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index afef79185f..cca3c54b1b 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2022 Pavel Shlyak <p.shlyak@pantherx.org>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2022 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2023 Aleksandr Vityazev <avityazew@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -364,8 +365,10 @@ (define (partition->dos-type partition)
;; Return the MBR partition type corresponding to the given PARTITION.
;; See: https://en.wikipedia.org/wiki/Partition_type.
(let ((flags (partition-flags partition))
- (file-system (partition-file-system partition)))
+ (file-system (partition-file-system partition))
+ (type-uuid (partition-type-uuid partition)))
(cond
+ (type-uuid (uuid->string type-uuid))
((member 'esp flags) "0xEF")
((string-prefix? "ext" file-system) "0x83")
((or (string=? file-system "vfat")
@@ -383,8 +386,10 @@ (define (partition->gpt-type partition)
;; given PARTITION. See:
;; https://github.com/pengutronix/genimage/blob/master/README.rst
(let ((flags (partition-flags partition))
- (file-system (partition-file-system partition)))
+ (file-system (partition-file-system partition))
+ (type-uuid (partition-type-uuid partition)))
(cond
+ (type-uuid (uuid->string type-uuid))
((member 'esp flags) "U")
((string-prefix? "ext" file-system) "L")
((or (string=? file-system "vfat")
base-commit: c371555a4b46a5c9288f54753b0f158f9c4b8abc
prerequisite-patch-id: 170079138c52aa59aa21a917f8d6b178c80c85d8
prerequisite-patch-id: 947e2640dcf1b47e6b1160b7525cbe7f7300e50b
--
2.39.2
--
Aleksandr Vityazev