stage4: Update beginner's guide URL, assuming the latest version is always first

This commit is contained in:
Serge Schneider 2023-11-29 16:14:37 +00:00
parent e07ee9b988
commit 02b371de1a

View File

@ -1,7 +1,7 @@
#!/bin/sh -e
BOOKSHELF_URL="https://magpi.raspberrypi.com/bookshelf.xml"
GUIDE_URL="$(curl -s "$BOOKSHELF_URL" | awk -F '[<>]' "/<TITLE>Raspberry Pi Beginner's Guide 4th Edition<\/TITLE>/ {f=1; next} f==1 && /PDF/ {print \$3; exit}")"
GUIDE_URL="$(curl -s "$BOOKSHELF_URL" | awk -F '[<>]' "/<TITLE>Raspberry Pi Beginner's Guide .*<\/TITLE>/ {f=1; next} f==1 && /PDF/ {print \$3; exit}")"
OUTPUT="$(basename "$GUIDE_URL" | cut -f1 -d'?')"
if [ ! -f "files/$OUTPUT" ]; then