aboutsummaryrefslogtreecommitdiff
path: root/gnu/build/image.scm
diff options
context:
space:
mode:
authorRoman Scherer <roman@burningswell.com>2024-10-03 14:13:32 +0200
committerLudovic Courtès <ludo@gnu.org>2024-10-14 14:08:43 +0200
commit886b410e6f641b473931d7269a9ddbf10a67937f (patch)
tree25f0b086415786e1d4c5470e335c947b2c47d0c7 /gnu/build/image.scm
parent727a72c5e26345257a5e6b83387d51b3b15cc542 (diff)
downloadguix-886b410e6f641b473931d7269a9ddbf10a67937f.tar.gz
guix-886b410e6f641b473931d7269a9ddbf10a67937f.zip
image: Add support for btrfs.
* gnu/build/image.scm (make-btrfs-image): New variable. * gnu/system/image.scm (system-disk-image): Support btrfs. Change-Id: I80a5b52ec478ce5927d6208e324cbb70282c647a Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/build/image.scm')
-rw-r--r--gnu/build/image.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 50518585f8..2332b72b17 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -73,6 +73,23 @@ turn doesn't take any constant overhead into account, force a 1-MiB minimum."
(max (ash 1 20)
(* 1.25 (file-size root))))
+(define* (make-btrfs-image partition target root)
+ "Handle the creation of BTRFS partition images. See
+'make-partition-image'."
+ (let ((size (partition-size partition))
+ (fs-options (partition-file-system-options partition))
+ (label (partition-label partition))
+ (uuid (partition-uuid partition)))
+ (apply invoke
+ `("fakeroot" "mkfs.btrfs" "-r" ,root
+ "-L" ,label
+ ,@(if uuid
+ `("-U" ,(uuid->string uuid))
+ '())
+ "--shrink"
+ ,@fs-options
+ ,target))))
+
(define* (make-ext-image partition target root
#:key
(owner-uid 0)
@@ -141,6 +158,8 @@ ROOT directory to populate the image."
(let* ((partition (sexp->partition partition-sexp))
(type (partition-file-system partition)))
(cond
+ ((string=? "btrfs" type)
+ (make-btrfs-image partition target root))
((string-prefix? "ext" type)
(make-ext-image partition target root))
((or (string=? type "vfat") (string=? type "fat16"))