Scripts: Set errexit to catch errors
This commit is contained in:
committed by
Matthias Mailänder
parent
7cd0d8c079
commit
946cd8f322
@@ -6,6 +6,8 @@
|
|||||||
# Copy-paste the entire script into http://shellcheck.net to check.
|
# Copy-paste the entire script into http://shellcheck.net to check.
|
||||||
####
|
####
|
||||||
|
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
patch_config()
|
patch_config()
|
||||||
{
|
{
|
||||||
LABEL=$1
|
LABEL=$1
|
||||||
|
|||||||
@@ -6,12 +6,14 @@
|
|||||||
# Copy-paste the entire script into http://shellcheck.net to check.
|
# Copy-paste the entire script into http://shellcheck.net to check.
|
||||||
####
|
####
|
||||||
|
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
# Set the working directory to the location of this script
|
# Set the working directory to the location of this script
|
||||||
cd "$(dirname "$0")" || exit 1
|
cd "$(dirname "$0")" || exit 1
|
||||||
|
|
||||||
# Database does not exist or is older than 30 days.
|
# Database does not exist or is older than 30 days.
|
||||||
if [ -z "$(find . -path ./IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP -mtime -30 -print)" ]; then
|
if [ -z "$(find . -path ./IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP -mtime -30 -print)" ]; then
|
||||||
rm -f IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
|
rm -f IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP || :
|
||||||
echo "Downloading IP2Location GeoIP database."
|
echo "Downloading IP2Location GeoIP database."
|
||||||
if command -v curl >/dev/null 2>&1; then
|
if command -v curl >/dev/null 2>&1; then
|
||||||
curl -s -L -O https://github.com/OpenRA/GeoIP-Database/releases/download/monthly/IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP || echo "Warning: Download failed"
|
curl -s -L -O https://github.com/OpenRA/GeoIP-Database/releases/download/monthly/IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP || echo "Warning: Download failed"
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
# $ Mod="d2k" ./launch-dedicated.sh # Launch a dedicated server with default settings but override the Mod
|
# $ Mod="d2k" ./launch-dedicated.sh # Launch a dedicated server with default settings but override the Mod
|
||||||
# Read the file to see which settings you can override
|
# Read the file to see which settings you can override
|
||||||
|
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
ENGINEDIR=$(dirname "$0")
|
ENGINEDIR=$(dirname "$0")
|
||||||
if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= "${ENGINEDIR}/bin/OpenRA.Server.dll")" = "0" ]; then
|
if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= "${ENGINEDIR}/bin/OpenRA.Server.dll")" = "0" ]; then
|
||||||
RUNTIME_LAUNCHER="mono --debug"
|
RUNTIME_LAUNCHER="mono --debug"
|
||||||
@@ -50,5 +52,5 @@ while true; do
|
|||||||
Server.EnableLintChecks="$EnableLintChecks" \
|
Server.EnableLintChecks="$EnableLintChecks" \
|
||||||
Server.ShareAnonymizedIPs="$ShareAnonymizedIPs" \
|
Server.ShareAnonymizedIPs="$ShareAnonymizedIPs" \
|
||||||
Server.JoinChatDelay="$JoinChatDelay" \
|
Server.JoinChatDelay="$JoinChatDelay" \
|
||||||
Engine.SupportDir="$SupportDir"
|
Engine.SupportDir="$SupportDir" || :
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
ENGINEDIR=$(dirname "$0")
|
ENGINEDIR=$(dirname "$0")
|
||||||
if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= "${ENGINEDIR}/bin/OpenRA.dll")" = "0" ]; then
|
if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= "${ENGINEDIR}/bin/OpenRA.dll")" = "0" ]; then
|
||||||
RUNTIME_LAUNCHER="mono --debug"
|
RUNTIME_LAUNCHER="mono --debug"
|
||||||
@@ -32,10 +34,10 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Launch the engine with the appropriate arguments
|
# Launch the engine with the appropriate arguments
|
||||||
${RUNTIME_LAUNCHER} "${ENGINEDIR}/bin/OpenRA.dll" Engine.EngineDir=".." Engine.LaunchPath="${LAUNCHPATH}" ${MODARG} "$@"
|
${RUNTIME_LAUNCHER} "${ENGINEDIR}/bin/OpenRA.dll" Engine.EngineDir=".." Engine.LaunchPath="${LAUNCHPATH}" ${MODARG} "$@" && rc=0 || rc=$?
|
||||||
|
|
||||||
# Show a crash dialog if something went wrong
|
# Show a crash dialog if something went wrong
|
||||||
if [ $? != 0 ] && [ $? != 1 ]; then
|
if [ "${rc}" != 0 ] && [ "${rc}" != 1 ]; then
|
||||||
if [ "$(uname -s)" = "Darwin" ]; then
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
LOGS="${HOME}/Library/Application Support/OpenRA/Logs/"
|
LOGS="${HOME}/Library/Application Support/OpenRA/Logs/"
|
||||||
else
|
else
|
||||||
@@ -45,12 +47,14 @@ if [ $? != 0 ] && [ $? != 1 ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test -d Support/Logs && LOGS="${PWD}/Support/Logs"
|
if [ -d Support/Logs ]; then
|
||||||
|
LOGS="${PWD}/Support/Logs"
|
||||||
|
fi
|
||||||
ERROR_MESSAGE=$(printf "%s has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in %s\nThe FAQ is available at http://wiki.openra.net/FAQ" "OpenRA" "${LOGS}")
|
ERROR_MESSAGE=$(printf "%s has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in %s\nThe FAQ is available at http://wiki.openra.net/FAQ" "OpenRA" "${LOGS}")
|
||||||
if command -v zenity > /dev/null; then
|
if command -v zenity > /dev/null; then
|
||||||
zenity --no-wrap --error --title "OpenRA" --no-markup --text "${ERROR_MESSAGE}" 2> /dev/null
|
zenity --no-wrap --error --title "OpenRA" --no-markup --text "${ERROR_MESSAGE}" 2> /dev/null || :
|
||||||
elif command -v kdialog > /dev/null; then
|
elif command -v kdialog > /dev/null; then
|
||||||
kdialog --title "OpenRA" --error "${ERROR_MESSAGE}"
|
kdialog --title "OpenRA" --error "${ERROR_MESSAGE}" || :
|
||||||
else
|
else
|
||||||
echo "${ERROR_MESSAGE}"
|
echo "${ERROR_MESSAGE}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
# Mod SDK Windows packaging
|
# Mod SDK Windows packaging
|
||||||
# Mod SDK macOS packaging
|
# Mod SDK macOS packaging
|
||||||
# Mod SDK Linux AppImage packaging
|
# Mod SDK Linux AppImage packaging
|
||||||
install_assemblies() {
|
install_assemblies() (
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
SRC_PATH="${1}"
|
SRC_PATH="${1}"
|
||||||
DEST_PATH="${2}"
|
DEST_PATH="${2}"
|
||||||
TARGETPLATFORM="${3}"
|
TARGETPLATFORM="${3}"
|
||||||
@@ -37,8 +39,8 @@ install_assemblies() {
|
|||||||
|
|
||||||
if [ "${RUNTIME}" = "mono" ]; then
|
if [ "${RUNTIME}" = "mono" ]; then
|
||||||
echo "Building assemblies"
|
echo "Building assemblies"
|
||||||
rm -rf "${SRC_PATH}/OpenRA."*/obj
|
rm -rf "${SRC_PATH}/OpenRA."*/obj || :
|
||||||
rm -rf "${SRC_PATH:?}/bin"
|
rm -rf "${SRC_PATH:?}/bin" || :
|
||||||
|
|
||||||
msbuild -verbosity:m -nologo -t:Build -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}"
|
msbuild -verbosity:m -nologo -t:Build -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}"
|
||||||
if [ "${TARGETPLATFORM}" = "unix-generic" ]; then
|
if [ "${TARGETPLATFORM}" = "unix-generic" ]; then
|
||||||
@@ -81,7 +83,7 @@ install_assemblies() {
|
|||||||
dotnet publish -c Release -p:TargetPlatform="${TARGETPLATFORM}" -p:CopyGenericLauncher="${COPY_GENERIC_LAUNCHER}" -p:CopyCncDll="${COPY_CNC_DLL}" -p:CopyD2kDll="${COPY_D2K_DLL}" -r "${TARGETPLATFORM}" -o "${DEST_PATH}" --self-contained true
|
dotnet publish -c Release -p:TargetPlatform="${TARGETPLATFORM}" -p:CopyGenericLauncher="${COPY_GENERIC_LAUNCHER}" -p:CopyCncDll="${COPY_CNC_DLL}" -p:CopyD2kDll="${COPY_D2K_DLL}" -r "${TARGETPLATFORM}" -o "${DEST_PATH}" --self-contained true
|
||||||
fi
|
fi
|
||||||
cd "${ORIG_PWD}" || exit 1
|
cd "${ORIG_PWD}" || exit 1
|
||||||
}
|
)
|
||||||
|
|
||||||
# Copy the core engine and specified mod data to the target directory
|
# Copy the core engine and specified mod data to the target directory
|
||||||
# Arguments:
|
# Arguments:
|
||||||
@@ -96,7 +98,9 @@ install_assemblies() {
|
|||||||
# Mod SDK Linux AppImage packaging
|
# Mod SDK Linux AppImage packaging
|
||||||
# Mod SDK macOS packaging
|
# Mod SDK macOS packaging
|
||||||
# Mod SDK Windows packaging
|
# Mod SDK Windows packaging
|
||||||
install_data() {
|
install_data() (
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
SRC_PATH="${1}"
|
SRC_PATH="${1}"
|
||||||
DEST_PATH="${2}"
|
DEST_PATH="${2}"
|
||||||
shift 2
|
shift 2
|
||||||
@@ -125,7 +129,7 @@ install_data() {
|
|||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
)
|
||||||
|
|
||||||
# Compile and publish (using Mono) a windows launcher with the specified mod details to the target directory
|
# Compile and publish (using Mono) a windows launcher with the specified mod details to the target directory
|
||||||
# Arguments:
|
# Arguments:
|
||||||
@@ -140,8 +144,9 @@ install_data() {
|
|||||||
# Used by:
|
# Used by:
|
||||||
# Windows packaging
|
# Windows packaging
|
||||||
# Mod SDK Windows packaging
|
# Mod SDK Windows packaging
|
||||||
install_windows_launcher()
|
install_windows_launcher() (
|
||||||
{
|
set -o errexit || exit $?
|
||||||
|
|
||||||
SRC_PATH="${1}"
|
SRC_PATH="${1}"
|
||||||
DEST_PATH="${2}"
|
DEST_PATH="${2}"
|
||||||
TARGETPLATFORM="${3}"
|
TARGETPLATFORM="${3}"
|
||||||
@@ -150,14 +155,14 @@ install_windows_launcher()
|
|||||||
MOD_NAME="${6}"
|
MOD_NAME="${6}"
|
||||||
FAQ_URL="${7}"
|
FAQ_URL="${7}"
|
||||||
|
|
||||||
rm -rf "${SRC_PATH}/OpenRA.WindowsLauncher/obj"
|
rm -rf "${SRC_PATH}/OpenRA.WindowsLauncher/obj" || :
|
||||||
dotnet publish "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -c Release -r "${TARGETPLATFORM}" -p:LauncherName="${LAUNCHER_NAME}" -p:TargetPlatform="${TARGETPLATFORM}" -p:ModID="${MOD_ID}" -p:DisplayName="${MOD_NAME}" -p:FaqUrl="${FAQ_URL}" -o "${DEST_PATH}" --self-contained true
|
dotnet publish "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -c Release -r "${TARGETPLATFORM}" -p:LauncherName="${LAUNCHER_NAME}" -p:TargetPlatform="${TARGETPLATFORM}" -p:ModID="${MOD_ID}" -p:DisplayName="${MOD_NAME}" -p:FaqUrl="${FAQ_URL}" -o "${DEST_PATH}" --self-contained true
|
||||||
|
|
||||||
# NET 6 is unable to customize the application host for windows when compiling from Linux,
|
# NET 6 is unable to customize the application host for windows when compiling from Linux,
|
||||||
# so we must patch the properties we need in the PE header.
|
# so we must patch the properties we need in the PE header.
|
||||||
# Setting the application icon requires an external tool, so is left to the calling code
|
# Setting the application icon requires an external tool, so is left to the calling code
|
||||||
python3 "${SRC_PATH}/packaging/windows/fixlauncher.py" "${DEST_PATH}/${LAUNCHER_NAME}.exe"
|
python3 "${SRC_PATH}/packaging/windows/fixlauncher.py" "${DEST_PATH}/${LAUNCHER_NAME}.exe"
|
||||||
}
|
)
|
||||||
|
|
||||||
# Write a version string to the engine VERSION file
|
# Write a version string to the engine VERSION file
|
||||||
# Arguments:
|
# Arguments:
|
||||||
@@ -171,11 +176,13 @@ install_windows_launcher()
|
|||||||
# Mod SDK Linux AppImage packaging
|
# Mod SDK Linux AppImage packaging
|
||||||
# Mod SDK macOS packaging
|
# Mod SDK macOS packaging
|
||||||
# Mod SDK Windows packaging
|
# Mod SDK Windows packaging
|
||||||
set_engine_version() {
|
set_engine_version() (
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
VERSION="${1}"
|
VERSION="${1}"
|
||||||
DEST_PATH="${2}"
|
DEST_PATH="${2}"
|
||||||
echo "${VERSION}" > "${DEST_PATH}/VERSION"
|
echo "${VERSION}" > "${DEST_PATH}/VERSION"
|
||||||
}
|
)
|
||||||
|
|
||||||
# Write a version string to a list of specified mod.yamls
|
# Write a version string to a list of specified mod.yamls
|
||||||
# Arguments:
|
# Arguments:
|
||||||
@@ -189,7 +196,9 @@ set_engine_version() {
|
|||||||
# Mod SDK Linux AppImage packaging
|
# Mod SDK Linux AppImage packaging
|
||||||
# Mod SDK macOS packaging
|
# Mod SDK macOS packaging
|
||||||
# Mod SDK Windows packaging
|
# Mod SDK Windows packaging
|
||||||
set_mod_version() {
|
set_mod_version() (
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
VERSION="${1}"
|
VERSION="${1}"
|
||||||
shift
|
shift
|
||||||
while [ -n "${1}" ]; do
|
while [ -n "${1}" ]; do
|
||||||
@@ -199,7 +208,7 @@ set_mod_version() {
|
|||||||
rm "${MOD_YAML_PATH}.tmp"
|
rm "${MOD_YAML_PATH}.tmp"
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
)
|
||||||
|
|
||||||
# Copy launch wrappers, application icons, desktop, and MIME files to the target directory
|
# Copy launch wrappers, application icons, desktop, and MIME files to the target directory
|
||||||
# Arguments:
|
# Arguments:
|
||||||
@@ -212,7 +221,9 @@ set_mod_version() {
|
|||||||
# MOD [MOD...]: One or more mod ids to copy (cnc, d2k, ra)
|
# MOD [MOD...]: One or more mod ids to copy (cnc, d2k, ra)
|
||||||
# Used by:
|
# Used by:
|
||||||
# Makefile (install-linux-shortcuts target for local installs and downstream packaging)
|
# Makefile (install-linux-shortcuts target for local installs and downstream packaging)
|
||||||
install_linux_shortcuts() {
|
install_linux_shortcuts() (
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
SRC_PATH="${1}"
|
SRC_PATH="${1}"
|
||||||
BUILD_PATH="${2}"
|
BUILD_PATH="${2}"
|
||||||
OPENRA_PATH="${3}"
|
OPENRA_PATH="${3}"
|
||||||
@@ -270,7 +281,7 @@ install_linux_shortcuts() {
|
|||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
)
|
||||||
|
|
||||||
# Copy AppStream metadata to the target directory
|
# Copy AppStream metadata to the target directory
|
||||||
# Arguments:
|
# Arguments:
|
||||||
@@ -280,7 +291,9 @@ install_linux_shortcuts() {
|
|||||||
# MOD [MOD...]: One or more mod ids to copy (cnc, d2k, ra)
|
# MOD [MOD...]: One or more mod ids to copy (cnc, d2k, ra)
|
||||||
# Used by:
|
# Used by:
|
||||||
# Makefile (install-linux-appdata target for local installs and downstream packaging)
|
# Makefile (install-linux-appdata target for local installs and downstream packaging)
|
||||||
install_linux_appdata() {
|
install_linux_appdata() (
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
SRC_PATH="${1}"
|
SRC_PATH="${1}"
|
||||||
BUILD_PATH="${2}"
|
BUILD_PATH="${2}"
|
||||||
SHARE_PATH="${3}"
|
SHARE_PATH="${3}"
|
||||||
@@ -315,4 +328,4 @@ install_linux_appdata() {
|
|||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
HERE="$(dirname "$(readlink -f "${0}")")"
|
HERE="$(dirname "$(readlink -f "${0}")")"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# OpenRA packaging script for Linux (AppImage)
|
# OpenRA packaging script for Linux (AppImage)
|
||||||
set -e
|
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
command -v tar >/dev/null 2>&1 || { echo >&2 "Linux packaging requires tar."; exit 1; }
|
command -v tar >/dev/null 2>&1 || { echo >&2 "Linux packaging requires tar."; exit 1; }
|
||||||
command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Linux packaging requires curl or wget."; exit 1; }
|
command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Linux packaging requires curl or wget."; exit 1; }
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
HERE="$(dirname "$(readlink -f "${0}")")"
|
HERE="$(dirname "$(readlink -f "${0}")")"
|
||||||
cd "${HERE}/../lib/openra" || exit 1
|
cd "${HERE}/../lib/openra" || exit 1
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
cd "{GAME_INSTALL_DIR}"
|
cd "{GAME_INSTALL_DIR}"
|
||||||
|
|
||||||
mono {DEBUG} OpenRA.Server.dll Game.Mod={MODID} "$@"
|
mono {DEBUG} OpenRA.Server.dll Game.Mod={MODID} "$@"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
# OpenRA.Utility relies on keeping the original working directory, so don't change directory
|
# OpenRA.Utility relies on keeping the original working directory, so don't change directory
|
||||||
HERE="$(dirname "$(readlink -f "${0}")")"
|
HERE="$(dirname "$(readlink -f "${0}")")"
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
LAUNCHER=$(readlink -f "${0}")
|
LAUNCHER=$(readlink -f "${0}")
|
||||||
HERE="$(dirname "${LAUNCHER}")"
|
HERE="$(dirname "${LAUNCHER}")"
|
||||||
cd "${HERE}/../lib/openra" || exit 1
|
cd "${HERE}/../lib/openra" || exit 1
|
||||||
@@ -43,21 +45,23 @@ fi
|
|||||||
|
|
||||||
# Run the game
|
# Run the game
|
||||||
export SDL_VIDEO_X11_WMCLASS="openra-{MODID}-{TAG}"
|
export SDL_VIDEO_X11_WMCLASS="openra-{MODID}-{TAG}"
|
||||||
./OpenRA Game.Mod={MODID} Engine.LaunchPath="${LAUNCHER}" "${JOIN_SERVER}" "$@"
|
./OpenRA Game.Mod={MODID} Engine.LaunchPath="${LAUNCHER}" "${JOIN_SERVER}" "$@" && rc=0 || rc=$?
|
||||||
|
|
||||||
# Show a crash dialog if something went wrong
|
# Show a crash dialog if something went wrong
|
||||||
if [ $? != 0 ] && [ $? != 1 ]; then
|
if [ "${rc}" != 0 ] && [ "${rc}" != 1 ]; then
|
||||||
LOGS="${XDG_CONFIG_HOME:-${HOME}/.config}/openra/Logs"
|
LOGS="${XDG_CONFIG_HOME:-${HOME}/.config}/openra/Logs"
|
||||||
if [ ! -d "${LOGS}" ] && [ -d "${HOME}/.openra/Logs" ]; then
|
if [ ! -d "${LOGS}" ] && [ -d "${HOME}/.openra/Logs" ]; then
|
||||||
LOGS="${HOME}/.openra/Logs"
|
LOGS="${HOME}/.openra/Logs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test -d Support/Logs && LOGS="${PWD}/Support/Logs"
|
if [ -d Support/Logs ]; then
|
||||||
|
LOGS="${PWD}/Support/Logs"
|
||||||
|
fi
|
||||||
ERROR_MESSAGE=$(printf "%s has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in %s\nThe FAQ is available at http://wiki.openra.net/FAQ" "{MODNAME}" "${LOGS}")
|
ERROR_MESSAGE=$(printf "%s has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in %s\nThe FAQ is available at http://wiki.openra.net/FAQ" "{MODNAME}" "${LOGS}")
|
||||||
if command -v zenity > /dev/null; then
|
if command -v zenity > /dev/null; then
|
||||||
zenity --no-wrap --error --title "{MODNAME}" --no-markup --text "${ERROR_MESSAGE}" 2> /dev/null
|
zenity --no-wrap --error --title "{MODNAME}" --no-markup --text "${ERROR_MESSAGE}" 2> /dev/null || :
|
||||||
elif command -v kdialog > /dev/null; then
|
elif command -v kdialog > /dev/null; then
|
||||||
kdialog --title "{MODNAME}" --error "${ERROR_MESSAGE}"
|
kdialog --title "{MODNAME}" --error "${ERROR_MESSAGE}" || :
|
||||||
elif "${HERE}/gtk-dialog.py" test > /dev/null; then
|
elif "${HERE}/gtk-dialog.py" test > /dev/null; then
|
||||||
"${HERE}/gtk-dialog.py" error --title "{MODNAME}" --text "${ERROR_MESSAGE}" 2> /dev/null
|
"${HERE}/gtk-dialog.py" error --title "{MODNAME}" --text "${ERROR_MESSAGE}" 2> /dev/null
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
cd "{GAME_INSTALL_DIR}"
|
cd "{GAME_INSTALL_DIR}"
|
||||||
|
|
||||||
# Search for server connection
|
# Search for server connection
|
||||||
@@ -9,21 +11,23 @@ if [ "${1#${PROTOCOL_PREFIX}}" != "${1}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the game
|
# Run the game
|
||||||
mono {DEBUG} OpenRA.dll Game.Mod={MODID} Engine.LaunchPath="{BIN_DIR}/openra-{MODID}" "${JOIN_SERVER}" "$@"
|
mono {DEBUG} OpenRA.dll Game.Mod={MODID} Engine.LaunchPath="{BIN_DIR}/openra-{MODID}" "${JOIN_SERVER}" "$@" && rc=0 || rc=$?
|
||||||
|
|
||||||
# Show a crash dialog if something went wrong
|
# Show a crash dialog if something went wrong
|
||||||
if [ $? != 0 ] && [ $? != 1 ]; then
|
if [ "${rc}" != 0 ] && [ "${rc}" != 1 ]; then
|
||||||
LOGS="${XDG_CONFIG_HOME:-${HOME}/.config}/openra/Logs"
|
LOGS="${XDG_CONFIG_HOME:-${HOME}/.config}/openra/Logs"
|
||||||
if [ ! -d "${LOGS}" ] && [ -d "${HOME}/.openra/Logs" ]; then
|
if [ ! -d "${LOGS}" ] && [ -d "${HOME}/.openra/Logs" ]; then
|
||||||
LOGS="${HOME}/.openra/Logs"
|
LOGS="${HOME}/.openra/Logs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test -d Support/Logs && LOGS="${PWD}/Support/Logs"
|
if [ -d Support/Logs ]; then
|
||||||
|
LOGS="${PWD}/Support/Logs"
|
||||||
|
fi
|
||||||
ERROR_MESSAGE=$(printf "%s has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in %s\nThe FAQ is available at http://wiki.openra.net/FAQ" "{MODNAME}" "${LOGS}")
|
ERROR_MESSAGE=$(printf "%s has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in %s\nThe FAQ is available at http://wiki.openra.net/FAQ" "{MODNAME}" "${LOGS}")
|
||||||
if command -v zenity > /dev/null; then
|
if command -v zenity > /dev/null; then
|
||||||
zenity --no-wrap --error --title "{MODNAME}" --no-markup --text "${ERROR_MESSAGE}" 2> /dev/null
|
zenity --no-wrap --error --title "{MODNAME}" --no-markup --text "${ERROR_MESSAGE}" 2> /dev/null || :
|
||||||
elif command -v kdialog > /dev/null; then
|
elif command -v kdialog > /dev/null; then
|
||||||
kdialog --title "{MODNAME}" --error "${ERROR_MESSAGE}"
|
kdialog --title "{MODNAME}" --error "${ERROR_MESSAGE}" || :
|
||||||
else
|
else
|
||||||
echo "${ERROR_MESSAGE}"
|
echo "${ERROR_MESSAGE}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
# MACOS_DEVELOPER_USERNAME: Email address for the developer account
|
# MACOS_DEVELOPER_USERNAME: Email address for the developer account
|
||||||
# MACOS_DEVELOPER_PASSWORD: App-specific password for the developer account
|
# MACOS_DEVELOPER_PASSWORD: App-specific password for the developer account
|
||||||
#
|
#
|
||||||
set -e
|
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
MONO_TAG="osx-launcher-20201222"
|
MONO_TAG="osx-launcher-20201222"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# OpenRA master packaging script
|
# OpenRA master packaging script
|
||||||
|
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
if [ $# -ne "2" ]; then
|
if [ $# -ne "2" ]; then
|
||||||
echo "Usage: ${0##*/} version outputdir."
|
echo "Usage: ${0##*/} version outputdir."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -19,14 +21,12 @@ function build_package() (
|
|||||||
}
|
}
|
||||||
#trap function executes on any error in the following commands
|
#trap function executes on any error in the following commands
|
||||||
trap "on_build $1" ERR
|
trap "on_build $1" ERR
|
||||||
set -e
|
|
||||||
echo "Building $1 package(s)."
|
echo "Building $1 package(s)."
|
||||||
cd "$1"
|
cd "$1"
|
||||||
./buildpackage.sh "${GIT_TAG}" "${BUILD_OUTPUT_DIR}"
|
./buildpackage.sh "${GIT_TAG}" "${BUILD_OUTPUT_DIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
#exit on any non-zero exited (failed) command
|
#exit on any non-zero exited (failed) command
|
||||||
set -e
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
build_package macos
|
build_package macos
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# OpenRA packaging script for versioned source tarball
|
# OpenRA packaging script for versioned source tarball
|
||||||
|
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
if [ $# -ne "2" ]; then
|
if [ $# -ne "2" ]; then
|
||||||
echo "Usage: $(basename "$0") tag outputdir"
|
echo "Usage: $(basename "$0") tag outputdir"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -19,7 +21,7 @@ make version VERSION="${TAG}"
|
|||||||
# The output from `git ls-tree` is too long to fit in a single command (overflows MAX_ARG_STRLEN)
|
# The output from `git ls-tree` is too long to fit in a single command (overflows MAX_ARG_STRLEN)
|
||||||
# so `xargs` will automatically split the input across multiple `tar` commands.
|
# so `xargs` will automatically split the input across multiple `tar` commands.
|
||||||
# Use the amend flag (r) to prevent each call erasing the output from earlier calls.
|
# Use the amend flag (r) to prevent each call erasing the output from earlier calls.
|
||||||
rm "${OUTPUTDIR}/OpenRA-${TAG}-source.tar"
|
rm "${OUTPUTDIR}/OpenRA-${TAG}-source.tar" || :
|
||||||
git ls-tree HEAD --name-only -r -z | xargs -0 tar vrf "${OUTPUTDIR}/OpenRA-${TAG}-source.tar"
|
git ls-tree HEAD --name-only -r -z | xargs -0 tar vrf "${OUTPUTDIR}/OpenRA-${TAG}-source.tar"
|
||||||
bzip2 "${OUTPUTDIR}/OpenRA-${TAG}-source.tar"
|
bzip2 "${OUTPUTDIR}/OpenRA-${TAG}-source.tar"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# OpenRA packaging script for Windows
|
# OpenRA packaging script for Windows
|
||||||
|
|
||||||
set -e
|
set -o errexit || exit $?
|
||||||
|
|
||||||
command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Windows packaging requires curl or wget."; exit 1; }
|
command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Windows packaging requires curl or wget."; exit 1; }
|
||||||
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
|
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit || exit $?
|
||||||
|
|
||||||
ENGINEDIR=$(dirname "$0")
|
ENGINEDIR=$(dirname "$0")
|
||||||
if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= "${ENGINEDIR}/bin/OpenRA.Utility.dll")" = "0" ]; then
|
if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= "${ENGINEDIR}/bin/OpenRA.Utility.dll")" = "0" ]; then
|
||||||
RUNTIME_LAUNCHER="mono --debug"
|
RUNTIME_LAUNCHER="mono --debug"
|
||||||
|
|||||||
Reference in New Issue
Block a user