diff options
author | Peter Elliott <pelliott@ualberta.ca> | 2020-07-28 10:20:06 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-28 18:32:05 +0200 |
commit | 6f12ab3cedfa7bfbed63ccaff109f0519184d67f (patch) | |
tree | a0bafca62ae77d89c6918778ce9c42526bcb50d0 /Meta/build-image-qemu.sh | |
parent | 99ddbb83e8fca90d4e1f8d1ac6f3e826b9c87c9a (diff) | |
download | serenity-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-qemu.sh')
-rwxr-xr-x | Meta/build-image-qemu.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Meta/build-image-qemu.sh b/Meta/build-image-qemu.sh index 86d6d271d6..badfc3907e 100755 --- a/Meta/build-image-qemu.sh +++ b/Meta/build-image-qemu.sh @@ -17,6 +17,13 @@ if [ "$(uname -s)" = "Darwin" ]; then export PATH="/usr/local/opt/e2fsprogs/bin:$PATH" export PATH="/usr/local/opt/e2fsprogs/sbin:$PATH" fi + +disk_usage() { + du -sm $1 | cut -f1 +} + +DISK_SIZE=$(($(disk_usage "$SERENITY_ROOT/Base") + $(disk_usage Root) + 100)) + echo "setting up disk image..." qemu-img create _disk_image "${DISK_SIZE:-600}"m || die "could not create disk image" chown "$SUDO_UID":"$SUDO_GID" _disk_image || die "could not adjust permissions on disk image" |