mirror of
https://github.com/gilbN/theme.park.git
synced 2024-11-20 18:12:31 +01:00
Set line feed in fetch script
This commit is contained in:
parent
8d8589c023
commit
ad5a877b75
12
fetch.sh
12
fetch.sh
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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"]')
|
MODS=$(curl https://theme-park.dev/themes.json | jq -r '.["docker-mods"]')
|
||||||
if [[ "$0" == "bash" ]]; then
|
if [[ "$0" == "bash" ]]; then
|
||||||
DIR="/tmp/theme-park-mods"
|
DIR="/tmp/theme-park-mods"
|
||||||
@ -11,7 +11,13 @@ mkdir -p "$DIR"
|
|||||||
printf "\nSaving mods into $DIR\n\n"
|
printf "\nSaving mods into $DIR\n\n"
|
||||||
jq -r 'to_entries | map(.key + "|" + (.value | tostring)) | .[]' <<< "$MODS" | \
|
jq -r 'to_entries | map(.key + "|" + (.value | tostring)) | .[]' <<< "$MODS" | \
|
||||||
while IFS='|' read key value; do
|
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"
|
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
|
done
|
||||||
chmod -R +x $DIR
|
chmod -R +x "$DIR"
|
Loading…
Reference in New Issue
Block a user