From 30aaf5accb3562da4a993e704cd34f618724fa70 Mon Sep 17 00:00:00 2001 From: GilbN Date: Wed, 11 Oct 2023 19:34:36 +0000 Subject: [PATCH] deploy: ad5a877b75b48513e46fc9e6c672d5b1f2ce1b02 --- fetch.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fetch.sh b/fetch.sh index e3f3fd37..6e868277 100644 --- a/fetch.sh +++ b/fetch.sh @@ -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 \ No newline at end of file +chmod -R +x "$DIR" \ No newline at end of file