From: "Ludovic Courtès" <ludo@gnu.org>
To: 28377@debbugs.gnu.org
Subject: [bug#28377] [PATCH 01/10] vm: Allow partitions to be initialized with a given UUID.
Date: Thu, 7 Sep 2017 00:17:47 +0200 [thread overview]
Message-ID: <20170906221756.17024-1-ludo@gnu.org> (raw)
In-Reply-To: <20170906215130.16411-1-ludo@gnu.org>
* gnu/build/vm.scm (<partition>)[uuid]: New field.
(create-ext-file-system): Add #:uuid and honor it.
(create-fat-file-system): Add #:uuid.
(format-partition): Add #:uuid and honor it.
(initialize-partition): Honor the 'uuid' field of PARTITION.
---
gnu/build/vm.scm | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 727494ad9..8dfaf2789 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -163,6 +163,7 @@ the #:references-graphs parameter of 'derivation'."
(size partition-size)
(file-system partition-file-system (default "ext4"))
(label partition-label (default #f))
+ (uuid partition-uuid (default #f))
(flags partition-flags (default '()))
(initializer partition-initializer (default (const #t))))
@@ -236,22 +237,26 @@ actual /dev name based on DEVICE."
(define MS_BIND 4096) ; <sys/mounts.h> again!
(define* (create-ext-file-system partition type
- #:key label)
+ #:key label uuid)
"Create an ext-family filesystem of TYPE on PARTITION. If LABEL is true,
-use that as the volume name."
+use that as the volume name. If UUID is true, use it as the partition UUID."
(format #t "creating ~a partition...\n" type)
(unless (zero? (apply system* (string-append "mkfs." type)
"-F" partition
- (if label
- `("-L" ,label)
- '())))
+ `(,@(if label
+ `("-L" ,label)
+ '())
+ ,@(if uuid
+ `("-U" ,(uuid->string uuid))
+ '()))))
(error "failed to create partition")))
(define* (create-fat-file-system partition
- #:key label)
+ #:key label uuid)
"Create a FAT filesystem on PARTITION. The number of File Allocation Tables
will be determined based on filesystem size. If LABEL is true, use that as the
volume name."
+ ;; FIXME: UUID is ignored!
(format #t "creating FAT partition...\n")
(unless (zero? (apply system* "mkfs.fat" partition
(if label
@@ -260,13 +265,13 @@ volume name."
(error "failed to create FAT partition")))
(define* (format-partition partition type
- #:key label)
+ #:key label uuid)
"Create a file system TYPE on PARTITION. If LABEL is true, use that as the
volume name."
(cond ((string-prefix? "ext" type)
- (create-ext-file-system partition type #:label label))
+ (create-ext-file-system partition type #:label label #:uuid uuid))
((or (string-prefix? "fat" type) (string= "vfat" type))
- (create-fat-file-system partition #:label label))
+ (create-fat-file-system partition #:label label #:uuid uuid))
(else (error "Unsupported file system."))))
(define (initialize-partition partition)
@@ -275,7 +280,8 @@ it, run its initializer, and unmount it."
(let ((target "/fs"))
(format-partition (partition-device partition)
(partition-file-system partition)
- #:label (partition-label partition))
+ #:label (partition-label partition)
+ #:uuid (partition-uuid partition))
(mkdir-p target)
(mount (partition-device partition) target
(partition-file-system partition))
--
2.14.1
next prev parent reply other threads:[~2017-09-06 22:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 21:51 [bug#28377] [PATCH 00/10] Allow users to specify the UUID of disk images Ludovic Courtès
2017-09-06 22:17 ` Ludovic Courtès [this message]
2017-09-06 22:17 ` [bug#28377] [PATCH 02/10] file-systems: Add UUID type dictionaries Ludovic Courtès
2017-09-11 15:50 ` Danny Milosavljevic
2017-09-11 16:04 ` Ludovic Courtès
2017-09-06 22:17 ` [bug#28377] [PATCH 03/10] services: base: Import the closure of (gnu build file-systems) Ludovic Courtès
2017-09-11 15:52 ` Danny Milosavljevic
2017-09-06 22:17 ` [bug#28377] [PATCH 04/10] file-systems: Introduce (gnu system uuid) Ludovic Courtès
2017-09-11 15:54 ` Danny Milosavljevic
2017-09-06 22:17 ` [bug#28377] [PATCH 05/10] services: file-system: Use 'file-system->spec' Ludovic Courtès
2017-09-11 15:55 ` Danny Milosavljevic
2017-09-06 22:17 ` [bug#28377] [PATCH 06/10] system: Introduce a disjoint UUID type Ludovic Courtès
2017-09-11 16:01 ` Danny Milosavljevic
2017-09-06 22:17 ` [bug#28377] [PATCH 07/10] system: Serialize the UUID type in the "parameters" file Ludovic Courtès
2017-09-11 16:02 ` Danny Milosavljevic
2017-09-06 22:17 ` [bug#28377] [PATCH 08/10] uuid: 'uuid' macro supports more UUID types Ludovic Courtès
2017-09-06 22:17 ` [bug#28377] [PATCH 09/10] vm: Allow users to specify a UUID for the root partition Ludovic Courtès
2017-09-11 16:10 ` Danny Milosavljevic
2017-09-11 20:53 ` bug#28377: " Ludovic Courtès
2017-09-06 22:17 ` [bug#28377] [PATCH 10/10] vm: Generate a UUID to identify the root file system Ludovic Courtès
2017-09-11 16:50 ` Danny Milosavljevic
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=20170906221756.17024-1-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=28377@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.