-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure the exit code is 0 on success and 1 on error
- Loading branch information
Showing
1 changed file
with
16 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
#!/bin/sh | ||
|
||
# SPDX-License-Identifier: MIT | ||
# SPDX-FileCopyrightText: Tobias Rehbein <[email protected]> | ||
# SPDX-FileCopyrightText: Tobias Rehbein <[email protected]> | ||
# SPDX-FileCopyrightText: Louis Moureaux <[email protected]> | ||
|
||
# Checks that the version numbers in the index file match those in the | ||
# modpacks. | ||
|
||
IFS='|' | ||
jq -r '.modpacks[] | "\(.name)|\(.version)|\(.url)"' index.json \ | ||
| while read NAME VERSION URL; do | ||
RVERSION=$({ if $(echo "$URL" | grep -q '^http'); then | ||
curl -s "$URL" | ||
else | ||
cat "$URL" | ||
fi } | jq -r '.info.version') | ||
|
||
[ "$VERSION" != "$RVERSION" ] \ | ||
&& echo "Version mismatch for \"$NAME\": index $VERSION; remote $RVERSION" | ||
done | ||
| { | ||
STATUS=0 | ||
while read NAME VERSION URL; do | ||
RVERSION=$({ if $(echo "$URL" | grep -q '^http'); then | ||
curl -s "$URL" | ||
else | ||
cat "$URL" | ||
fi } | jq -r '.info.version') | ||
|
||
[ "$VERSION" != "$RVERSION" ] \ | ||
&& STATUS=1 \ | ||
&& echo "Version mismatch for \"$NAME\": index $VERSION; remote $RVERSION" | ||
done | ||
exit $STATUS | ||
} |