1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:14:58 +00:00

Build: Sprinkle some portability, fix on OpenBSD

realpath(1) is specific to coreutils and its behavior can be had
with readlink -f

Create the Toolchain Build directory if it doesn't exist before
calling readlink, since realpath(3) on at least OpenBSD will error
on a non-existent path
This commit is contained in:
joshua stein 2020-12-28 17:36:15 -06:00 committed by Andreas Kling
parent 4021264201
commit 0d215b5548
4 changed files with 15 additions and 6 deletions

View file

@ -19,7 +19,8 @@ if [ "$(uname -s)" = "Darwin" ]; then
fi
disk_usage() {
du -sm "$1" | cut -f1
# shellcheck disable=SC2003
expr "$(du -sk "$1" | cut -f1)" / 1024
}
DISK_SIZE=$(($(disk_usage "$SERENITY_ROOT/Base") + $(disk_usage Root) + 100))
@ -33,7 +34,7 @@ printf "creating new filesystem... "
if [ "$(uname -s)" = "OpenBSD" ]; then
VND=$(vnconfig _disk_image)
(echo "e 0"; echo 83; echo n; echo 0; echo "*"; echo "quit") | fdisk -e "$VND"
mkfs.ext2 -I 128 -F "/dev/${VND}i" || die "could not create filesystem"
newfs_ext2fs -D 128 "/dev/r${VND}i" || die "could not create filesystem"
elif [ "$(uname -s)" = "FreeBSD" ]; then
MD=$(mdconfig _disk_image)
mke2fs -q -I 128 _disk_image || die "could not create filesystem"