run-dosbox.sh 973 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. #
  3. # Simple dosbox wrapper
  4. #
  5. basedir="$(realpath -s "$0" | xargs dirname)"
  6. tooldir="$(realpath -P "$0" | xargs dirname)"
  7. die()
  8. {
  9. echo "ERROR: $*" >&2
  10. exit 1
  11. }
  12. rootdir=
  13. while [ $# -gt 0 ]; do
  14. case "$1" in
  15. *)
  16. [ -z "$rootdir" ] || die "Unknown option: $*"
  17. rootdir="$*"
  18. ;;
  19. esac
  20. shift
  21. done
  22. [ -d "$rootdir" ] || die "Selected root directory '$rootdir' not found."
  23. rootdir="$(realpath "$rootdir")"
  24. conf="$rootdir/dosbox.conf"
  25. [ -r "$conf" ] || die "Configuration file '$conf' is not readable."
  26. cd "$rootdir" || die "Failed to enter rootdir."
  27. mkdir -p "$rootdir/c/bin" ||\
  28. die "Failed to make bin directory."
  29. if ! [ -e "$rootdir/c/bin/kfast.com" ]; then
  30. python3 "$tooldir/gen_kfast.py" "$rootdir/c/bin/kfast.com" ||\
  31. die "Failed to make KFAST.COM"
  32. fi
  33. dosbox \
  34. -conf "$tooldir/dosbox.conf" \
  35. -conf "$conf" ||\
  36. die "Dosbox exited with an error."
  37. # vim: ts=4 sw=4 expandtab