[gnome-build-meta/abderrahim/xz-image-size: 3/3] vm/image.bst: make the image only as big as necessary




commit e22793f1ff2f1ea18a6c2560432569a30bdc8aa0
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Sat Sep 12 16:02:49 2020 +0100

    vm/image.bst: make the image only as big as necessary
    
    This makes the installer go much faster at the cost of needing a resize for
    those using the image directly

 elements/vm/image.bst | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/elements/vm/image.bst b/elements/vm/image.bst
index a30d4ab0..f13331ae 100644
--- a/elements/vm/image.bst
+++ b/elements/vm/image.bst
@@ -72,6 +72,11 @@ config:
     cp -r "%{sysroot}"/ostree/boot.1/gnome-os/*/*/boot/EFI/ "%{sysroot}/boot/"
 
   - |
+    get_size() {
+      size=$(($(du --apparent-size -B 512 -s "${1}" | cut -f1)/2))
+      echo $((${size}+(${size}/10)))k
+    }
+
     cat > %{install-root}/genimage.cfg <<EOF
     image efi.img {
         vfat {
@@ -85,7 +90,7 @@ config:
             label = "root"
             use-mke2fs = true
         }
-        size = 16G
+        size = $(get_size %{sysroot})
     }
     image disk.img {
         hdimage {


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