forked from taylorwentzel/eclipse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·57 lines (44 loc) · 1.23 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -e
if ! which mednafen >/dev/null 2>&1
then
cat - <<\EOF
It doesn't look like you have mednafen installed.
On mac, if you have brew:
$ brew install mednafen
On Ubuntu/Debian:
$ sudo apt-get install mednafen
On other platforms check your distro's package manager.
EOF
exit 1
fi
# Run builds in a build directory so everything stays nice and clean
if [ ! -d build ]; then
mkdir build
else
rm -rf build/*
fi
# The Makefile changes the user's $HOME/.mednafen config files.
# Since we're not running in a VM, lets not do that.
if [ ! -d .mednafen ]; then
mkdir .mednafen
fi
if [ ! -f .mednafen/mednafen-09x.cfg ]; then
echo "symlinking config file"
ln -s ../mednafen-09x.cfg .mednafen/mednafen-09x.cfg
fi
export MEDNAFEN_HOME=$(pwd)/.mednafen
find . -mindepth 1 -maxdepth 1 ! -name build -exec cp -r {} build \;
docker_bootstrap() {
docker run --rm -v "$(pwd)":/cs2110/host/ -it -w="/cs2110/host" --entrypoint "/bin/bash" -u="root:root" dbecker1/cs2110docker -c "$*"
}
# Now the good stuff...
cd build
docker_bootstrap make "$@"
cd ..
prog_name=$(find build -name '*.gba' | head -n 1)
if [ ! -z "$prog_name" ]; then
exec mednafen "$prog_name"
else
echo "Didn't find a .gba file to run"
fi