Update MagPi URL scheme
This commit is contained in:
parent
ca31aef1f7
commit
bdbd85892e
1 changed files with 3 additions and 3 deletions
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
magpi_regex="MagPi[[:digit:]]*.pdf"
|
magpi_regex="MagPi[[:digit:]]*.pdf"
|
||||||
magpi_loc="https://www.raspberrypi.org/magpi-issues"
|
magpi_loc="$(curl -s https://magpi.raspberrypi.org/latest-pdf)"
|
||||||
magpi_latest="$(curl "$magpi_loc/?C=M;O=D" -s | grep "$magpi_regex" -m 1 -o | head -n 1)"
|
magpi_latest="$(echo "$magpi_loc" | grep "$magpi_regex" -m 1 -o)"
|
||||||
|
|
||||||
if [ ! -f "files/$magpi_latest" ]; then
|
if [ ! -f "files/$magpi_latest" ]; then
|
||||||
find files/ -regextype grep -regex "files/$magpi_regex" -delete
|
find files/ -regextype grep -regex "files/$magpi_regex" -delete
|
||||||
wget "$magpi_loc/$magpi_latest" -O "files/$magpi_latest"
|
wget "$magpi_loc" -O "files/$magpi_latest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
file "files/$magpi_latest" | grep -q "PDF document"
|
file "files/$magpi_latest" | grep -q "PDF document"
|
||||||
|
|
Loading…
Reference in a new issue