diff options
Diffstat (limited to 'fetchpk3.sh')
| -rwxr-xr-x | fetchpk3.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fetchpk3.sh b/fetchpk3.sh new file mode 100755 index 0000000..7c2394e --- /dev/null +++ b/fetchpk3.sh | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | . ./.env || { | ||
| 4 | echo ".env file not found or failed to load" | ||
| 5 | exit 1 | ||
| 6 | } | ||
| 7 | |||
| 8 | mkdir -p "$DIR" | ||
| 9 | |||
| 10 | wget -nc -nd -r -l1 --no-parent -A '*.pk3' -P "$DIR" "$URL" \ | ||
| 11 | || { | ||
| 12 | echo "wget not present, fallback to curl..." | ||
| 13 | curl -s "$URL" \ | ||
| 14 | | grep -o 'href="[^"]*\.pk3"' \ | ||
| 15 | | cut -d'"' -f2 \ | ||
| 16 | | while read -r f; do | ||
| 17 | [ -f "$DIR/$f" ] || curl -# -o "$DIR/$f" "$URL/$f" | ||
| 18 | done | ||
| 19 | } | ||
