From patchwork Fri Apr 14 06:53:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aleksandr Vityazev X-Patchwork-Id: 49152 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 17B281753F; Fri, 14 Apr 2023 07:54:19 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,RCVD_IN_SORBS_WEB,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E28591753E for ; Fri, 14 Apr 2023 07:54:16 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pnDJu-0007wo-Ie; Fri, 14 Apr 2023 02:54:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pnDJq-0007wZ-Na for guix-patches@gnu.org; Fri, 14 Apr 2023 02:54:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pnDJq-0004Mv-Eo for guix-patches@gnu.org; Fri, 14 Apr 2023 02:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pnDJq-00032R-9i for guix-patches@gnu.org; Fri, 14 Apr 2023 02:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62827] [PATCH] image: Add partition type-uuid support. Resent-From: Aleksandr Vityazev Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 14 Apr 2023 06:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62827 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62827@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168145523211661 (code B ref -1); Fri, 14 Apr 2023 06:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Apr 2023 06:53:52 +0000 Received: from localhost ([127.0.0.1]:45322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnDJf-000320-IM for submit@debbugs.gnu.org; Fri, 14 Apr 2023 02:53:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:59186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnDJa-00031q-MF for submit@debbugs.gnu.org; Fri, 14 Apr 2023 02:53:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pnDJY-0007vz-V7 for guix-patches@gnu.org; Fri, 14 Apr 2023 02:53:44 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pnDJI-0004HJ-9a for guix-patches@gnu.org; Fri, 14 Apr 2023 02:53:43 -0400 Received: by mail-pj1-x1032.google.com with SMTP id l9-20020a17090a3f0900b0023d32684e7fso7915086pjc.1 for ; Thu, 13 Apr 2023 23:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681455203; x=1684047203; h=content-transfer-encoding:mime-version:user-agent:message-id:date :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=B8+2ghDrw4leCxEkdqPMDhB3r6oej7uCLeoOTHs8MwU=; b=kx7ZN7pnB4AcoITR8xHI3CxnqjbDepj6tQ+J2DUmIh0P5QCWaq0UP6aAwxjRjls8Ti 8V+WPppc32kBM7vZfrGHIuVQVtSyQbGOEToaJd9+jTxVX/kkZ5I8NcxXqQVW5E6Y3za9 oQOgiK2o7UXgqktYYuaHC5/NvOgbKIF2012LsQmTk/hxgs8b86J+SxpDBDDaIT4sv3CL +27/UW59lh7xeECOkf6Y86OOlWD1Vl64IjtNJA/PU1/O6AaqE7S21TMRSt+SUofvFlbj 6jklrI3Jhfx0sCyIvjeofzEWesUJpsCDM+9jsYF0AzYpdscB/Ggdsk1+Jsp5BmJ8NjjB QX1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681455203; x=1684047203; h=content-transfer-encoding:mime-version:user-agent:message-id:date :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=B8+2ghDrw4leCxEkdqPMDhB3r6oej7uCLeoOTHs8MwU=; b=g/gsmN3q9vMtXGwT9NdcdKZNM4xwq9KL6U2L1hJT54SHr8LxzxgGKlj7iMt0OAJvzD TZdibncRVtivGQcycRDXHWZteTwYidlAaArSrXJn1IhWlxPoGuiCDOJv17fDOB/sNS7X NsJObBe8Gtr2RMzUpBHcTvvwaDEPjPC3vpsEn2LXifm218ky5uG6bvpjUt8m6ct8ZS32 YFedzxTIXbFInTfIdDk5zfzRlHmK9lqH8SDUqd0zGoeaJVZRU+fOBYNhWcCBq0neMtHj 6Xdt5qMKRhgR1IDE9sX/9dbmXntEYUsCYL76cTSR+6pNo+/LCQhVmsTJRSxDmf6eIlMu oCNA== X-Gm-Message-State: AAQBX9dC4xdruYQKHAQqNmHaaSTiRApFpOzqSjZoUN18D61M07zl3dfp HXsC9XYMx1TKWgcZmnVLHyt1bRbz6cQ= X-Google-Smtp-Source: AKy350b6W2yEBTorLaTtXkWVwBufn7mqoSrQJML2hD6A9dyZS1amSXpUw34s//14ZMmwsP3nHv3/pg== X-Received: by 2002:a17:90b:358e:b0:23f:b609:e704 with SMTP id mm14-20020a17090b358e00b0023fb609e704mr4431181pjb.1.1681455203040; Thu, 13 Apr 2023 23:53:23 -0700 (PDT) Received: from magi (host-47-152-66-217.spbmts.ru. [217.66.152.47]) by smtp.gmail.com with ESMTPSA id q6-20020a17090a938600b0023f8bdc4a7fsm416787pjo.14.2023.04.13.23.53.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Apr 2023 23:53:22 -0700 (PDT) From: Aleksandr Vityazev Date: Fri, 14 Apr 2023 09:53:14 +0300 Message-ID: <87pm87j6p1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=avityazew@gmail.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/image.scm ()[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(-) base-commit: c371555a4b46a5c9288f54753b0f158f9c4b8abc prerequisite-patch-id: 170079138c52aa59aa21a917f8d6b178c80c85d8 prerequisite-patch-id: 947e2640dcf1b47e6b1160b7525cbe7f7300e50b 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 +;;; Copyright © 2023 Aleksandr Vityazev ;;; ;;; 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 make-partition (label partition-label) ;string (uuid partition-uuid (default #false)) ; + (type-uuid partition-type-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 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli ;;; Copyright © 2022 Alex Griffin +;;; Copyright © 2023 Aleksandr Vityazev ;;; ;;; 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")