Skip to content

Instantly share code, notes, and snippets.

@milouse
Created December 21, 2016 10:22
Show Gist options
  • Save milouse/4c15a5e1e4a96daa383738dadbda0f2f to your computer and use it in GitHub Desktop.
Save milouse/4c15a5e1e4a96daa383738dadbda0f2f to your computer and use it in GitHub Desktop.
Shell function to download the last torbrowser version
dl_latest_tor_browser() {
OLD_PWD=$(pwd)
LAST_VER=$(\curl -s 'https://www.torproject.org/projects/torbrowser.html.en' | sed -n "s|^.*\.\./dist/torbrowser/\([0-9]\.[0-9]\.[0-9]\)/tor-browser-linux64-\([0-9]\.[0-9]\.[0-9]\)_fr\.tar\.xz\".*$|\1|p")
if [ ! -n "$LAST_VER" ]; then
LAST_VER=$(\curl -s 'https://www.torproject.org/projects/torbrowser.html.en' | sed -n "s|^.*\.\./dist/torbrowser/\([0-9]\.[0-9]\)/tor-browser-linux64-\([0-9]\.[0-9]\)_fr\.tar\.xz\".*$|\1|p")
fi
cd "$HOME/Téléchargements"
if [ -d 'tor-browser_fr' ]; then
CUR_VER=$(sed -n 1p tor-browser_fr/Browser/TorBrowser/Docs/ChangeLog.txt | sed -n "s/^Tor Browser \(.*\) -- .*$/\1/p")
if [ "$LAST_VER" = "$CUR_VER" ]; then
echo "You already have the last stable release: $LAST_VER"
echo ''
echo "Start it with: ${HOME}/Téléchargements/tor-browser_fr/Browser/start-tor-browser --detach"
cd "$OLD_PWD"
return
fi
rm -rf tor-browser_fr
fi
TOR_BUNDLE="tor-browser-linux64-${LAST_VER}_fr.tar.xz"
[ -f "$TOR_BUNDLE" ] && rm "$TOR_BUNDLE"
[ -f "$TOR_BUNDLE.asc" ] && rm "$TOR_BUNDLE.asc"
wget "https://dist.torproject.org/torbrowser/${LAST_VER}/${TOR_BUNDLE}"
wget "https://dist.torproject.org/torbrowser/${LAST_VER}/${TOR_BUNDLE}.asc"
gpg --verify ${TOR_BUNDLE}{.asc,}
tar xJf ${TOR_BUNDLE}
rm "$TOR_BUNDLE" "$TOR_BUNDLE.asc"
echo ''
echo "The TOR browser v${LAST_VER} is here: ${HOME}/Téléchargements/tor-browser_fr"
echo ''
echo "Start it with: ${HOME}/Téléchargements/tor-browser_fr/Browser/start-tor-browser --detach"
cd "$OLD_PWD"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment