summaryrefslogtreecommitdiffstats
path: root/dos/run-dosbox.sh
blob: 1c857e87334962995ac3d3837246af0d17e7ed09 (plain)
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
#!/bin/sh
#
# Simple dosbox wrapper
#

basedir="$(realpath -s "$0" | xargs dirname)"
tooldir="$(realpath -P "$0" | xargs dirname)"

die()
{
    echo "ERROR: $*" >&2
    exit 1
}

rootdir=

while [ $# -gt 0 ]; do
    case "$1" in
        *)
            [ -z "$rootdir" ] || die "Unknown option: $*"
            rootdir="$*"
            ;;
    esac
    shift
done

[ -d "$rootdir" ] || die "Selected root directory '$rootdir' not found."
rootdir="$(realpath "$rootdir")"
conf="$rootdir/dosbox.conf"
[ -r "$conf" ] || die "Configuration file '$conf' is not readable."

cd "$rootdir" || die "Failed to enter rootdir."

mkdir -p "$rootdir/c/bin" ||\
    die "Failed to make bin directory."
if ! [ -e "$rootdir/c/bin/kfast.com" ]; then
    python3 "$tooldir/gen_kfast.py" "$rootdir/c/bin/kfast.com" ||\
        die "Failed to make KFAST.COM"
fi

dosbox \
    -conf "$tooldir/dosbox.conf" \
    -conf "$conf" ||\
    die "Dosbox exited with an error."

# vim: ts=4 sw=4 expandtab
bues.ch cgit interface