From 6f12ab3cedfa7bfbed63ccaff109f0519184d67f Mon Sep 17 00:00:00 2001 From: Peter Elliott Date: Tue, 28 Jul 2020 10:20:06 -0600 Subject: Meta: Calculate image size based on size of Build/Root and Base This reduces the size of the default build, while allowing people to install as many ports as they want, without having to manually specify disk size. --- Meta/build-image-grub.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Meta/build-image-grub.sh') diff --git a/Meta/build-image-grub.sh b/Meta/build-image-grub.sh index fff4f64eb5..9f40fe36ed 100755 --- a/Meta/build-image-grub.sh +++ b/Meta/build-image-grub.sh @@ -23,6 +23,12 @@ if [ -z "$grub" ]; then fi echo "using grub-install at ${grub}" +disk_usage() { + du -sm $1 | cut -f1 +} + +DISK_SIZE=$(($(disk_usage "$SERENITY_ROOT/Base") + $(disk_usage Root) + 300)) + echo "setting up disk image..." dd if=/dev/zero of=grub_disk_image bs=1M count="${DISK_SIZE:-800}" status=none || die "couldn't create disk image" chown "$SUDO_UID":"$SUDO_GID" grub_disk_image || die "couldn't adjust permissions on disk image" -- cgit v1.2.3