From 9691472b8462af3086ea74be016fe168838489d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 5 Apr 2020 11:07:18 +0200 Subject: [PATCH] Backport #307 to 0.17 --- 0.17/files/update-mods.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/0.17/files/update-mods.sh b/0.17/files/update-mods.sh index 62629a2..bd252dd 100755 --- a/0.17/files/update-mods.sh +++ b/0.17/files/update-mods.sh @@ -32,16 +32,17 @@ update_mod() MOD_INFO_URL="$MOD_BASE_URL/api/mods/$MOD_NAME" MOD_INFO_JSON=$(curl --silent "$MOD_INFO_URL") + if ! echo "$MOD_INFO_JSON" | jq -e .name >/dev/null; then + print_success " Custom mod not on $MOD_BASE_URL, skipped." + return 0 + fi + MOD_INFO=$(echo "$MOD_INFO_JSON" | jq -j --arg version "$FACTORIO_VERSION" ".releases|reverse|map(select(.info_json.factorio_version as \$mod_version | \$version | startswith(\$mod_version)))[0]|.file_name, \";\", .download_url, \";\", .sha1") MOD_FILENAME=$(echo "$MOD_INFO" | cut -f1 -d";") MOD_URL=$(echo "$MOD_INFO" | cut -f2 -d";") MOD_SHA1=$(echo "$MOD_INFO" | cut -f3 -d";") - if [[ -z $MOD_URL ]]; then - return 1 - fi - if [[ $MOD_FILENAME == null ]]; then print_failure " Not compatible with version" return 1