-
-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
4 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,17 +1,23 @@ | ||
#!/usr/bin/env bash | ||
# Downloads all docker mod scripts | ||
|
||
# Downloads all docker mod scripts | ||
MODS=$(curl https://theme-park.dev/themes.json | jq -r '.["docker-mods"]') | ||
if [[ "$0" == "bash" ]]; then | ||
DIR="/tmp/theme-park-mods" | ||
else | ||
DIR="$0" | ||
DIR="$0" | ||
fi | ||
mkdir -p "$DIR" | ||
printf "\nSaving mods into $DIR\n\n" | ||
jq -r 'to_entries | map(.key + "|" + (.value | tostring)) | .[]' <<< "$MODS" | \ | ||
while IFS='|' read key value; do | ||
curl "$value" --create-dirs --output "$DIR/98-themepark-$key" --silent | ||
download_file="$DIR/98-themepark-$key" | ||
curl "$value" --create-dirs --output "$download_file" --silent | ||
echo "Fetched $key script" | ||
|
||
# Convert line endings from CRLF to LF manually | ||
if [[ "$(tail -c2 "$download_file")" == $'\r\n' ]]; then | ||
perl -pi -e 's/\r\n/\n/' "$download_file" | ||
fi | ||
done | ||
chmod -R +x $DIR | ||
chmod -R +x "$DIR" |