summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-05-26 16:25:25 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-05-26 17:16:42 +0200
commitbd3716f6fee127562935d86ff7f641197366769c (patch)
tree5d3dbf901fa407d28f06f5e30557f99ee0c568da /gnu
parent6ac7526e488ad3dd73080d1c00efe2066b1bf0a2 (diff)
downloadguix-bd3716f6fee127562935d86ff7f641197366769c.tar.gz
image: Add partition file-system options support.
* gnu/image.scm (<partition>)[file-system-options]: New field,
(partition-file-system-options): new exported procedure.
* gnu/system/image.scm (partition->gexp): Adapt accordingly.
* gnu/build/image.scm (sexp->partition): Also adapt accordingly,
(make-ext-image): and pass file-system options to mke2fs.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/build/image.scm28
-rw-r--r--gnu/image.scm19
-rw-r--r--gnu/system/image.scm1
3 files changed, 28 insertions, 20 deletions
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 23fc56571f..b37ea9332a 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -47,9 +47,10 @@
   "Take SEXP, a tuple as returned by 'partition->gexp', and turn it into a
 <partition> record."
   (match sexp
-    ((size file-system label uuid)
+    ((size file-system file-system-options label uuid)
      (partition (size size)
                 (file-system file-system)
+                (file-system-options file-system-options)
                 (label label)
                 (uuid uuid)))))
 
@@ -71,19 +72,22 @@ take the partition metadata size into account, take a 25% margin."
 'make-partition-image'."
   (let ((size (partition-size partition))
         (fs (partition-file-system partition))
+        (fs-options (partition-file-system-options partition))
         (label (partition-label partition))
         (uuid (partition-uuid partition))
-        (options "lazy_itable_init=1,lazy_journal_init=1"))
-    (invoke "mke2fs" "-t" fs "-d" root
-            "-L" label "-U" (uuid->string uuid)
-            "-E" (format #f "root_owner=~a:~a,~a"
-                         owner-uid owner-gid options)
-            target
-            (format #f "~ak"
-                    (size-in-kib
-                     (if (eq? size 'guess)
-                         (estimate-partition-size root)
-                         size))))))
+        (journal-options "lazy_itable_init=1,lazy_journal_init=1"))
+    (apply invoke
+           `("mke2fs" "-t" ,fs "-d" ,root
+             "-L" ,label "-U" ,(uuid->string uuid)
+             "-E" ,(format #f "root_owner=~a:~a,~a"
+                           owner-uid owner-gid journal-options)
+             ,@fs-options
+             ,target
+             ,(format #f "~ak"
+                      (size-in-kib
+                       (if (eq? size 'guess)
+                           (estimate-partition-size root)
+                           size)))))))
 
 (define* (make-vfat-image partition target root)
   "Handle the creation of VFAT partition images.  See 'make-partition-image'."
diff --git a/gnu/image.scm b/gnu/image.scm
index b434ed50e3..0a92d168e9 100644
--- a/gnu/image.scm
+++ b/gnu/image.scm
@@ -24,6 +24,7 @@
             partition-size
             partition-offset
             partition-file-system
+            partition-file-system-options
             partition-label
             partition-uuid
             partition-flags
@@ -46,14 +47,16 @@
 
 (define-record-type* <partition> partition make-partition
   partition?
-  (device      partition-device (default #f))
-  (size        partition-size)
-  (offset      partition-offset (default 0))
-  (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 #f)))
+  (device               partition-device (default #f))
+  (size                 partition-size)
+  (offset               partition-offset (default 0))
+  (file-system          partition-file-system (default "ext4"))
+  (file-system-options  partition-file-system-options
+                        (default '()))
+  (label                partition-label (default #f))
+  (uuid                 partition-uuid (default #f))
+  (flags                partition-flags (default '()))
+  (initializer          partition-initializer (default #f)))
 
 
 ;;;
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index cb770a17e8..a1214dd20a 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -117,6 +117,7 @@
 'make-partition-image'."
   #~'(#$@(list (partition-size partition))
       #$(partition-file-system partition)
+      #$(partition-file-system-options partition)
       #$(partition-label partition)
       #$(and=> (partition-uuid partition)
                uuid-bytevector)))