summary refs log tree commit diff
path: root/gnu/build/image.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-06-22 17:40:10 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-06-22 17:49:19 +0200
commit7f75a7ec08975eb6d6e01db61bd6b91f447f655e (patch)
tree49bc72e041adcc440be172358a23968ad1d19633 /gnu/build/image.scm
parentcf14e67963147d5ecccb820203e601080f856f74 (diff)
downloadguix-7f75a7ec08975eb6d6e01db61bd6b91f447f655e.tar.gz
system: image: Remove "image-root" when building raw disk-images.
The "image-root" derivation output is used as a temporary directory that is
passed to mke2fs and mkdosfs later on. By merging the creation of this
directory and the production of partition images, we can get rid of the
derivation.

As mke2fs and mkdosfs are not able to override file permissions, call those
commands with fakeroot. This way, all the image files will be owned by root,
even if image generation is done in an unprivilegded context.

* gnu/system/image.scm (system-disk-image): Merge "image-root" and
"iso9660-image" derivations so that we spare an extra derivation. Also add
"fakeroot" and its runtime dependencies to the inputs.
* gnu/build/image.scm (make-ext-image, make-vfat-image): Make sure that mke2fs
and mkdosfs are respectively called by fakeroot.
Diffstat (limited to 'gnu/build/image.scm')
-rw-r--r--gnu/build/image.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index e8df5866a7..e7b0418182 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -77,7 +77,7 @@ take the partition metadata size into account, take a 25% margin."
         (uuid (partition-uuid partition))
         (journal-options "lazy_itable_init=1,lazy_journal_init=1"))
     (apply invoke
-           `("mke2fs" "-t" ,fs "-d" ,root
+           `("fakeroot" "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)
@@ -93,7 +93,8 @@ take the partition metadata size into account, take a 25% margin."
   "Handle the creation of VFAT partition images.  See 'make-partition-image'."
   (let ((size (partition-size partition))
         (label (partition-label partition)))
-    (invoke "mkdosfs" "-n" label "-C" target "-F" "16" "-S" "1024"
+    (invoke "fakeroot" "mkdosfs" "-n" label "-C" target
+            "-F" "16" "-S" "1024"
             (size-in-kib
              (if (eq? size 'guess)
                  (estimate-partition-size root)