From 49662b606930e7ece64eef6f375669b4f80b4588 Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 8 Aug 2023 15:43:20 +0200 Subject: [PATCH] tools: Calculate the needed fs size dynamically --- tools/make-iso.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/make-iso.sh b/tools/make-iso.sh index 915c39e2..1076b2de 100755 --- a/tools/make-iso.sh +++ b/tools/make-iso.sh @@ -7,6 +7,10 @@ cd $LUNA_ROOT fakeroot -u -s $LUNA_ROOT/.fakeroot -- tools/install.sh -fakeroot -u -i $LUNA_ROOT/.fakeroot -- genext2fs -d base -B 4096 -b 8192 -L luna-rootfs -N 2048 build/ext2fs.bin +disk_space=$(du -s base | awk '{ print $1 }') +min_blocks=$(($disk_space / 4)) # This is just the blocks needed for all the files in the file system: this excludes space for the inode table, block group descriptors, etc. +blocks=$(($min_blocks + 1024)) # This is the actual number of blocks we're using. + +fakeroot -u -i $LUNA_ROOT/.fakeroot -- genext2fs -d base -B 4096 -b $blocks -L luna-rootfs -N 1024 build/ext2fs.bin mkbootimg luna.json Luna.iso