diff options
author | Brenton Horne | 2023-01-10 19:10:07 +1000 |
---|---|---|
committer | Brenton Horne | 2023-01-10 19:10:07 +1000 |
commit | 98cf54b6b5d0fe8b27f0a956e1f20ff31001d526 (patch) | |
tree | 1737538239047354bf02a4a4e4687a5307c82333 /openra-rv | |
parent | 9caa5200ef229dfce88424b9aad629d101eda666 (diff) | |
download | aur-98cf54b6b5d0fe8b27f0a956e1f20ff31001d526.tar.gz |
Fixing build errors
Diffstat (limited to 'openra-rv')
-rwxr-xr-x | openra-rv | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/openra-rv b/openra-rv index 1943f58bfab8..b7e79307d7ef 100755 --- a/openra-rv +++ b/openra-rv @@ -1,19 +1,52 @@ #!/bin/sh -cd "/usr/lib/openra-rv" - -# Run the game -mono --debug OpenRA.Game.exe Game.Mod=rv Engine.LaunchPath="/usr/bin/openra-rv" "Engine.ModSearchPaths=/usr/lib/openra-rv/mods" "$@" - -# Show a crash dialog if something went wrong -if [ $? != 0 ] && [ $? != 1 ]; then - ERROR_MESSAGE="OpenRA Romanov's Vengeance has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in ~/.openra/Logs\nThe FAQ is available at http://wiki.openra.net/FAQ" - if command -v zenity > /dev/null; then - zenity --no-wrap --error --title "OpenRA Romanov's Vengeance" --text "${ERROR_MESSAGE}" 2> /dev/null - elif command -v kdialog > /dev/null; then - kdialog --title "OpenRA Romanov's Vengeance" --error "${ERROR_MESSAGE}" - else - printf "${ERROR_MESSAGE}\n" - fi - exit 1 + +set -e +command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires mono."; exit 1; } +if command -v python3 >/dev/null 2>&1; then + PYTHON="python3" +else + command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires python."; exit 1; } + PYTHON="python" +fi + +require_variables() { + missing="" + for i in "$@"; do + eval check="\$$i" + [ -z "${check}" ] && missing="${missing} ${i}\n" + done + if [ ! -z "${missing}" ]; then + echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again." + exit 1 + fi +} + +TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))") +PRELIM_MOD_ID=$(echo $TEMPLATE_LAUNCHER | cut -d '/' -f 4) +TEMPLATE_ROOT=/usr/lib/$PRELIM_MOD_ID +MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods" + +# shellcheck source=mod.config +. "${TEMPLATE_ROOT}/mod.config" + +if [ -f "${TEMPLATE_ROOT}/user.config" ]; then + # shellcheck source=user.config + . "${TEMPLATE_ROOT}/user.config" +fi + +require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY" +cd "${TEMPLATE_ROOT}" +if [ ! -f "${ENGINE_DIRECTORY}/bin/OpenRA.dll" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then + echo "Required engine files not found." + echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; + exit 1 +fi + +if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= ${ENGINE_DIRECTORY}/bin/OpenRA.dll)" = "0" ]; then + RUNTIME_LAUNCHER="mono --debug" +else + RUNTIME_LAUNCHER="dotnet" fi +cd "${ENGINE_DIRECTORY}" +${RUNTIME_LAUNCHER} bin/OpenRA.dll Engine.EngineDir=".." Engine.LaunchPath="${TEMPLATE_LAUNCHER}" "Engine.ModSearchPaths=${MOD_SEARCH_PATHS}" Game.Mod="${MOD_ID}" "$@" |