2018-06-07 12:44:08 -04:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
magpi_regex="MagPi[[:digit:]]*.pdf"
|
2020-01-27 10:20:33 -05:00
|
|
|
magpi_loc="$(curl -s https://magpi.raspberrypi.org/latest-pdf)"
|
|
|
|
magpi_latest="$(echo "$magpi_loc" | grep "$magpi_regex" -m 1 -o)"
|
2018-06-07 12:44:08 -04:00
|
|
|
|
|
|
|
if [ ! -f "files/$magpi_latest" ]; then
|
|
|
|
find files/ -regextype grep -regex "files/$magpi_regex" -delete
|
2020-01-27 10:20:33 -05:00
|
|
|
wget "$magpi_loc" -O "files/$magpi_latest"
|
2018-06-07 12:44:08 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
file "files/$magpi_latest" | grep -q "PDF document"
|
|
|
|
|
2019-01-15 06:14:45 -05:00
|
|
|
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/MagPi"
|
|
|
|
install -v -o 1000 -g 1000 -m 644 "files/$magpi_latest" "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/MagPi/"
|