diff --git a/stage4/03-magpi/00-run.sh b/stage4/03-magpi/00-run.sh new file mode 100755 index 0000000..da00ecc --- /dev/null +++ b/stage4/03-magpi/00-run.sh @@ -0,0 +1,16 @@ +#!/bin/sh -e + +magpi_regex="MagPi[[:digit:]]*.pdf" +magpi_loc="https://www.raspberrypi.org/magpi-issues" +magpi_latest="$(curl "$magpi_loc/?C=M;O=D" -s | grep "$magpi_regex" -m 1 -o | head -n 1)" + +if [ ! -f "files/$magpi_latest" ]; then + find files/ -regextype grep -regex "files/$magpi_regex" -delete + wget "$magpi_loc/$magpi_latest" -O "files/$magpi_latest" +fi + +file "files/$magpi_latest" | grep -q "PDF document" + +install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/MagPi" +install -v -o 1000 -g 1000 -m 644 "files/$magpi_latest" "${ROOTFS_DIR}/home/pi/MagPi/" + diff --git a/stage4/03-magpi/files/.gitignore b/stage4/03-magpi/files/.gitignore new file mode 100644 index 0000000..a136337 --- /dev/null +++ b/stage4/03-magpi/files/.gitignore @@ -0,0 +1 @@ +*.pdf