Skip to content

Instantly share code, notes, and snippets.

@gfa
Created January 16, 2016 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfa/f0c7f7927ac5966f4417 to your computer and use it in GitHub Desktop.
Save gfa/f0c7f7927ac5966f4417 to your computer and use it in GitHub Desktop.
#!/bin/sh -e
nm-online || exit 0
logger "empezando $0"
#export http_proxy="http://192.168.255.1:3128"
LOCAL_VERSION=`grep ^Version /opt/firefox/application.ini | awk -F = '{print $2}'`
LATEST_VERSION=`curl -v https://download.mozilla.org/\?product\=firefox-latest\&os\=linux\&lang\=en-US 2>&1 |grep Location | cut -c 90- | sed 's/firefox-//' | sed 's/.tar.bz2//' |sed 's/\r//'`
if [ ${LOCAL_VERSION}x != ${LATEST_VERSION}x ]; then
TEMPDIR=`mktemp -d`
cd $TEMPDIR
#rm -f firefox-$LATEST_VERSION.tar.bz2 MD5SUMS
wget -q https://download.mozilla.org/\?product\=firefox-latest\&os\=linux\&lang\=en-US -O firefox-$LATEST_VERSION.tar.bz2
wget -q http://download.cdn.mozilla.net/pub/firefox/releases/${LATEST_VERSION}/SHA512SUMS
wget -q http://download.cdn.mozilla.net/pub/firefox/releases/${LATEST_VERSION}/SHA512SUMS.asc
gpg --verify SHA512SUMS.asc
MD5=`sha512sum firefox-$LATEST_VERSION.tar.bz2`
grep $MD5 SHA512SUMS |grep linux-i686/en-US/firefox-$LATEST_VERSION.tar.bz2
tar xjf firefox-$LATEST_VERSION.tar.bz2 -C /opt
fi
logger "finalizando $0"
rm -rf $TEMPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment