Files
OpenRA/packaging/linux/AppRun.in
2018-05-05 22:34:27 +02:00

39 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Make sure the user has a sufficiently recent version of mono on the PATH
MINIMUM_MONO_VERSION="4.2"
make_version() {
echo "$1" | tr '.' '\n' | head -n 4 | xargs printf "%03d%03d%03d%03d";
}
mono_missing_or_old() {
command -v mono >/dev/null 2>&1 || return 0
MONO_VERSION=$(mono --version | head -n1 | cut -d' ' -f5)
[ "$(make_version "${MONO_VERSION}")" -lt "$(make_version "${MINIMUM_MONO_VERSION}")" ] && return 0
return 1
}
if mono_missing_or_old; then
ERROR_MESSAGE="{MODNAME} requires Mono ${MINIMUM_MONO_VERSION} or greater.\nPlease install Mono using your system package manager."
if command -v zenity > /dev/null; then
zenity --no-wrap --error --title "{MODNAME}" --text "${ERROR_MESSAGE}" 2> /dev/null
elif command -v kdialog > /dev/null; then
kdialog --title "{MODNAME}" --error "${ERROR_MESSAGE}"
else
printf "${ERROR_MESSAGE}"
fi
exit 1
fi
# Run the game or server
HERE="$(dirname "$(readlink -f "${0}")")"
export PATH="${HERE}"/usr/bin/:"${PATH}"
export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}"
if [ -n "$1" ] && [ "$1" = "--server" ]; then
exec "openra-{MODID}-server" "$@"
else
exec "openra-{MODID}" "$@"
fi