Skip to content

Instantly share code, notes, and snippets.

@jagland
Created November 15, 2014 09:51
Show Gist options
  • Save jagland/94b1ecea1abda30376eb to your computer and use it in GitHub Desktop.
Save jagland/94b1ecea1abda30376eb to your computer and use it in GitHub Desktop.
pfSense Mirror
#!/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