From e2fd7ce7ed1ce13a3bb7623f73862d5cb0c19bd6 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 5 Jun 2022 14:07:32 +0200 Subject: [PATCH] Scripts: Remove some subshells that ignore errors --- fetch-geoip.sh | 3 ++- packaging/linux/AppRun.in | 3 ++- packaging/linux/buildpackage.sh | 3 ++- packaging/linux/openra-server.appimage.in | 3 ++- packaging/linux/openra-utility.appimage.in | 3 ++- packaging/macos/buildpackage.sh | 3 ++- packaging/source/buildpackage.sh | 3 ++- packaging/windows/buildpackage.sh | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/fetch-geoip.sh b/fetch-geoip.sh index 3cc3805e2a..482b4ea5b0 100755 --- a/fetch-geoip.sh +++ b/fetch-geoip.sh @@ -9,7 +9,8 @@ set -o errexit || exit $? # Set the working directory to the location of this script -cd "$(dirname "$0")" || exit 1 +HERE=$(dirname "$0") +cd "${HERE}" || exit 1 # Database does not exist or is older than 30 days. if [ -z "$(find . -path ./IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP -mtime -30 -print)" ]; then diff --git a/packaging/linux/AppRun.in b/packaging/linux/AppRun.in index f8b6b67161..61aa0c9ae5 100755 --- a/packaging/linux/AppRun.in +++ b/packaging/linux/AppRun.in @@ -1,7 +1,8 @@ #!/bin/sh set -o errexit || exit $? -HERE="$(dirname "$(readlink -f "${0}")")" +LAUNCHER=$(readlink -f "${0}") +HERE=$(dirname "${LAUNCHER}") # Run the game or server if [ -n "$1" ] && [ "$1" = "--server" ]; then diff --git a/packaging/linux/buildpackage.sh b/packaging/linux/buildpackage.sh index 0eb4933431..1c4f03da46 100755 --- a/packaging/linux/buildpackage.sh +++ b/packaging/linux/buildpackage.sh @@ -14,7 +14,8 @@ if [ $# -eq "0" ]; then fi # Set the working dir to the location of this script -cd "$(dirname "$0")" || exit 1 +HERE=$(dirname "$0") +cd "${HERE}" || exit 1 . ../functions.sh TAG="$1" diff --git a/packaging/linux/openra-server.appimage.in b/packaging/linux/openra-server.appimage.in index c4857691b9..037c07c7df 100755 --- a/packaging/linux/openra-server.appimage.in +++ b/packaging/linux/openra-server.appimage.in @@ -1,7 +1,8 @@ #!/bin/sh set -o errexit || exit $? -HERE="$(dirname "$(readlink -f "${0}")")" +LAUNCHER=$(readlink -f "${0}") +HERE=$(dirname "${LAUNCHER}") cd "${HERE}/../lib/openra" || exit 1 ./OpenRA.Server Game.Mod="{MODID}" "$@" diff --git a/packaging/linux/openra-utility.appimage.in b/packaging/linux/openra-utility.appimage.in index 55130d43cf..94fdbddfd7 100755 --- a/packaging/linux/openra-utility.appimage.in +++ b/packaging/linux/openra-utility.appimage.in @@ -2,5 +2,6 @@ set -o errexit || exit $? # OpenRA.Utility relies on keeping the original working directory, so don't change directory -HERE="$(dirname "$(readlink -f "${0}")")" +LAUNCHER=$(readlink -f "${0}") +HERE=$(dirname "${LAUNCHER}") "${HERE}/../lib/openra/OpenRA.Utility" {MODID} "$@" diff --git a/packaging/macos/buildpackage.sh b/packaging/macos/buildpackage.sh index 768ba81c56..3eded8c958 100755 --- a/packaging/macos/buildpackage.sh +++ b/packaging/macos/buildpackage.sh @@ -29,7 +29,8 @@ if [[ "${OSTYPE}" != "darwin"* ]]; then fi # Set the working dir to the location of this script -cd "$(dirname "${0}")" || exit 1 +HERE=$(dirname "${0}") +cd "${HERE}" || exit 1 . ../functions.sh # Import code signing certificate diff --git a/packaging/source/buildpackage.sh b/packaging/source/buildpackage.sh index 6895c77cf6..18168adac1 100755 --- a/packaging/source/buildpackage.sh +++ b/packaging/source/buildpackage.sh @@ -9,7 +9,8 @@ if [ $# -ne "2" ]; then fi # Set the working dir to the location of this script -cd "$(dirname "$0")" || exit 1 +HERE=$(dirname "$0") +cd "${HERE}" || exit 1 TAG="$1" OUTPUTDIR="$2" diff --git a/packaging/windows/buildpackage.sh b/packaging/windows/buildpackage.sh index 90886c7af6..b11fc3c13b 100755 --- a/packaging/windows/buildpackage.sh +++ b/packaging/windows/buildpackage.sh @@ -15,7 +15,8 @@ if [ $# -ne "2" ]; then fi # Set the working dir to the location of this script -cd "$(dirname "$0")" || exit 1 +HERE=$(dirname "$0") +cd "${HERE}" || exit 1 . ../functions.sh TAG="$1"