Scripts: Set errexit to catch errors

This commit is contained in:
Unrud
2022-06-05 14:07:24 +02:00
committed by Matthias Mailänder
parent 7cd0d8c079
commit 946cd8f322
17 changed files with 84 additions and 41 deletions

View File

@@ -6,12 +6,14 @@
# 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
cd "$(dirname "$0")" || 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
rm -f IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
rm -f IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP || :
echo "Downloading IP2Location GeoIP database."
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"