summaryrefslogtreecommitdiff
path: root/Meta/run.sh
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2020-06-24 04:47:20 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-01 12:53:39 +0200
commit1d9791bcdf6c2be33d869c015f67f44ab2336923 (patch)
tree1c7772796fc0bba63a969e7dad73d3de8d29942f /Meta/run.sh
parentaabb482d5c65fb3986015bfc9b20286d9d79aae3 (diff)
downloadserenity-1d9791bcdf6c2be33d869c015f67f44ab2336923.zip
Meta: Allow running run.sh from any where by setting SERENITY_BUILD
If SERENITY_BUILD is not set or empty, SERENITY_BUILD is treated as if it was set to '.'. `run.sh` will cd to SERENITY_BUILD before running the emulator. Also, export SERENITY_BUILD in `Meta/CLion/run.sh` since we are using it in `Meta/run.sh`. Also, allow using a different bochs configuration file by setting the SERENITY_BOCHSRC variable.
Diffstat (limited to 'Meta/run.sh')
-rwxr-xr-xMeta/run.sh15
1 files changed, 14 insertions, 1 deletions
diff --git a/Meta/run.sh b/Meta/run.sh
index d7ed43d6c0..934960cbaf 100755
--- a/Meta/run.sh
+++ b/Meta/run.sh
@@ -3,6 +3,11 @@
set -e
+die() {
+ echo "die: $*"
+ exit 1
+}
+
#SERENITY_PACKET_LOGGING_ARG="-object filter-dump,id=hue,netdev=breh,file=e1000.pcap"
[ -e /dev/kvm ] && [ -r /dev/kvm ] && [ -w /dev/kvm ] && SERENITY_KVM_ARG="-enable-kvm"
@@ -47,9 +52,17 @@ $SERENITY_EXTRA_QEMU_ARGS
export SDL_VIDEO_X11_DGAMOUSE=0
+: "${SERENITY_BUILD:=.}"
+cd -P -- "$SERENITY_BUILD" || die "Could not cd to \"$SERENITY_BUILD\""
+
if [ "$1" = "b" ]; then
# ./run b: bochs
- "$SERENITY_BOCHS_BIN" -q -f "$SERENITY_ROOT/Meta/bochsrc"
+ [ -z "$SERENITY_BOCHSRC" ] && {
+ # Make sure that SERENITY_ROOT is set and not empty
+ [ -z "$SERENITY_ROOT" ] && die 'SERENITY_ROOT not set or empty'
+ SERENITY_BOCHSRC="$SERENITY_ROOT/Meta/bochsrc"
+ }
+ "$SERENITY_BOCHS_BIN" -q -f "$SERENITY_BOCHSRC"
elif [ "$1" = "qn" ]; then
# ./run qn: qemu without network
"$SERENITY_QEMU_BIN" \