RECORDANDRONCO/packaging/linux/include/AppRun.in
Paul Chote 0ebff73e8e Add Linux AppImage packaging.
Requires a system installation of mono >= 4.2
but bundles all other requirements.
2018-04-08 15:33:50 +01:00

37 lines
1.1 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
if command -v zenity > /dev/null
then
zenity --no-wrap --error --title "{MODNAME}" --text "{MODNAME} requires Mono ${MINIMUM_MONO_VERSION} or greater.\nPlease install Mono using your system package manager."
else
printf "{MODNAME} requires Mono %s or greater.\nPlease install Mono using your system package manager.\n" "${MINIMUM_MONO_VERSION}"
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