guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: system: image: Remove "image-root" when building


From: guix-commits
Subject: branch master updated: system: image: Remove "image-root" when building raw disk-images.
Date: Mon, 22 Jun 2020 11:50:14 -0400

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 7f75a7e  system: image: Remove "image-root" when building raw 
disk-images.
7f75a7e is described below

commit 7f75a7ec08975eb6d6e01db61bd6b91f447f655e
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Mon Jun 22 17:40:10 2020 +0200

    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.
---
 gnu/build/image.scm  |  5 +++--
 gnu/system/image.scm | 27 +++++++++++++--------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index e8df586..e7b0418 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)
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 9f210d9..43217dd 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -255,18 +255,24 @@ used in the image."
              (graph (match inputs
                       (((names . _) ...)
                        names)))
-             (root-builder
+             (type (partition-file-system partition))
+             (image-builder
               (with-imported-modules*
-               (let* ((initializer #$(partition-initializer partition)))
+               (let ((initializer #$(partition-initializer partition))
+                     (inputs '#+(list e2fsprogs fakeroot dosfstools mtools
+                                      sed coreutils))
+                     (image-root "tmp-root"))
                  (sql-schema #$schema)
 
+                 (set-path-environment-variable "PATH" '("bin" "sbin") inputs)
+
                  ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be
                  ;; decoded.
                  (setenv "GUIX_LOCPATH"
                          #+(file-append glibc-utf8-locales "/lib/locale"))
                  (setlocale LC_ALL "en_US.utf8")
 
-                 (initializer #$output
+                 (initializer image-root
                               #:references-graphs '#$graph
                               #:deduplicate? #f
                               #:system-directory #$os
@@ -277,19 +283,12 @@ used in the image."
                               #+(bootloader-installer bootloader)
                               #:bootcfg #$bootcfg
                               #:bootcfg-location
-                              #$(bootloader-configuration-file bootloader)))))
-             (image-root
-              (computed-file "partition-image-root" root-builder
-                             #:options `(#:references-graphs ,inputs)))
-             (type (partition-file-system partition))
-             (image-builder
-              (with-imported-modules*
-               (let ((inputs '#+(list e2fsprogs dosfstools mtools)))
-                 (set-path-environment-variable "PATH" '("bin" "sbin") inputs)
+                              #$(bootloader-configuration-file bootloader))
                  (make-partition-image #$(partition->gexp partition)
                                        #$output
-                                       #$image-root)))))
-        (computed-file "partition.img" image-builder)))
+                                       image-root)))))
+        (computed-file "partition.img" image-builder
+                       #:options `(#:references-graphs ,inputs))))
 
     (define (partition->config partition)
       ;; Return the genimage partition configuration for PARTITION.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]