Created
November 15, 2014 09:51
-
-
Save jagland/94b1ecea1abda30376eb to your computer and use it in GitHub Desktop.
pfSense Mirror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Use this to create a local pfSense mirror as the updates | |
# can sometimes be a bit slow in the UK, useful if you have multiple boxes. | |
# you can specify multiple URLs, in this case grabbing x86 and amd64 | |
TMPFILE=`mktemp` | |
updateurl='http://updates.pfsense.org' | |
urls='_updaters _updaters/amd64' | |
dest='/var/www/localhost/htdocs/pfsense' | |
for j in $urls; | |
do | |
MYURL=$updateurl'/'$j'/version' | |
wget -q -O $TMPFILE $MYURL | |
diff $TMPFILE $dest/$j/version >/dev/null | |
if [ $? -ne 0 ] | |
then | |
files='latest.tgz latest.tgz.md5 latest.tgz.sha256' | |
for q in $files | |
do | |
wget -q -O $dest'/'$j'/'$q $updateurl'/'$j'/'$q | |
cp $TMPFILE $dest'/'$j'/version' | |
mail -s "New pfSense version" root@localhost < $TMPFILE | |
done | |
fi | |
done | |
rm $TMPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment