exelaunch.sh 849 Bytes
#!/bin/sh
#
# This is a first very simple script to identify a given M$ executable
# and launch it with the correct interpreter, either Dosbox or Wine so far.
#
# Author: Georg Hopp <georg@steffers.org>
# Changelog:
#  2017-02-07 Start work on this
#

function get_interpreter() {
	local EXE="$1"

	echo "$(basename "${EXE}")" >&2

	case "$(file -b "${EXE}")" in
		*DOS*)
			local CONFIG="${HOME}/.dosbox/$(basename "${EXE}").conf"
			if [ ! \( -e "${CONFIG}" \) ]
			then
				cp "${HOME}/.dosbox/dosbox-SVN.conf" "${CONFIG}"
			fi
			echo -n "/usr/bin/dosbox -exit -conf ${CONFIG}"
			;;
		*Windows\ shortcut*) echo -n "/usr/bin/wine start";;
		*Windows*) echo -n "/usr/bin/wine";;
	esac
}

EXE="$1"; shift
WINEXE="${EXE/${WINEPREFIX}drive_c/C:}"
WINEXE="${WINEXE//\//\\}"
exec $(get_interpreter "${EXE}") "${WINEXE}" "$@"

# vim: ft=sh ts=4 sw=4: