From: Aleksandr Vityazev <avityazew@gmail.com>
To: 62827@debbugs.gnu.org
Subject: [bug#62827] [PATCH] image: Add partition type-uuid support.
Date: Fri, 14 Apr 2023 09:53:14 +0300 [thread overview]
Message-ID: <87pm87j6p1.fsf@gmail.com> (raw)
* 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(-)
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
next reply other threads:[~2023-04-14 6:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 6:53 Aleksandr Vityazev [this message]
2023-05-13 8:06 ` [bug#62827] [PATCH] image: Add partition type-uuid support Josselin Poiret via Guix-patches via
2023-10-14 20:04 ` bug#62827: " Mathieu Othacehe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pm87j6p1.fsf@gmail.com \
--to=avityazew@gmail.com \
--cc=62827@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.