summaryrefslogtreecommitdiff
path: root/Meta/build-image-grub.sh
diff options
context:
space:
mode:
authorPeter Elliott <pelliott@ualberta.ca>2020-07-28 10:20:06 -0600
committerAndreas Kling <kling@serenityos.org>2020-07-28 18:32:05 +0200
commit6f12ab3cedfa7bfbed63ccaff109f0519184d67f (patch)
treea0bafca62ae77d89c6918778ce9c42526bcb50d0 /Meta/build-image-grub.sh
parent99ddbb83e8fca90d4e1f8d1ac6f3e826b9c87c9a (diff)
downloadserenity-6f12ab3cedfa7bfbed63ccaff109f0519184d67f.zip
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.
Diffstat (limited to 'Meta/build-image-grub.sh')
-rwxr-xr-xMeta/build-image-grub.sh6
1 files changed, 6 insertions, 0 deletions
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"