Skip to content

Commit

Permalink
Bookshelf PDF download
Browse files Browse the repository at this point in the history
  • Loading branch information
XECDesign committed May 13, 2020
1 parent 08fc0b9 commit b9bb59c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
15 changes: 15 additions & 0 deletions stage4/03-bookshelf/00-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh -e

BOOKSHELF_URL="https://magpi.raspberrypi.org/bookshelf.xml"
GUIDE_URL="$(curl -s "$BOOKSHELF_URL" | awk -F '[<>]' "/<TITLE>Raspberry Pi Beginner's Guide v3<\/TITLE>/ {f=1; next} f==1 && /PDF/ {print \$3; exit}")"
OUTPUT="$(basename "$GUIDE_URL" | cut -f1 -d'?')"

if [ ! -f "files/$OUTPUT" ]; then
rm files/*.pdf -f
curl -s "$GUIDE_URL" -o "files/$OUTPUT"
fi

file "files/$OUTPUT" | grep -q "PDF document"

install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/Bookshelf"
install -v -o 1000 -g 1000 -m 644 "files/$OUTPUT" "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/Bookshelf/"
File renamed without changes.
15 changes: 0 additions & 15 deletions stage4/03-magpi/00-run.sh

This file was deleted.

0 comments on commit b9bb59c

Please sign in to comment.