diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-11-03 13:47:04 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-11-03 13:47:04 -0200 |
commit | 3bc9efbcdbe240c6f97d84fb5f1403f92d70126d (patch) | |
tree | b4512950252e4997be97ecf3feaa5d21bd083d26 /tor-browser-dl | |
parent | 3d581cd8b8c5833b13e3dbbc88a499b559b1d80d (diff) | |
download | scripts-3bc9efbcdbe240c6f97d84fb5f1403f92d70126d.tar.gz scripts-3bc9efbcdbe240c6f97d84fb5f1403f92d70126d.tar.bz2 |
Adding tor-browser-dl
Diffstat (limited to 'tor-browser-dl')
-rwxr-xr-x | tor-browser-dl | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tor-browser-dl b/tor-browser-dl new file mode 100755 index 0000000..cc7449b --- /dev/null +++ b/tor-browser-dl @@ -0,0 +1,63 @@ +#!/bin/bash +# +# Download the Tor Browser Bundle. +# + +# Parameters +BASENAME="`basename $0`" +APPS="$HOME/apps" +APP_BASE="$APPS/tor-browser" +TEMP="$TMP/tor-browser" +DL="$HOME/data/apps/distros/tor/" +VERSION="$1" +ARCH="$2" +LANG="$3" +BASE_URL="https://www.torproject.org/dist/torbrowser/linux/" + +# Syntax check +if [ -z "$VERSION" ]; then + echo "usage: $BASENAME <version> [arch] [lang]" + echo "example: $BASENAME 2.3.25-14-dev x86_64 en-US" + exit 1 +fi + +# Set arch +if [ -z "$ARCH" ]; then + ARCH="x86_64" +fi + +# Set lang +if [ -z "$LANG" ]; then + LANG="en-US" +fi + +# Set file names +FILE="tor-browser-gnu-linux-$ARCH-$VERSION-$LANG.tar.gz" +SIGN="$FILE.asc" + +# Check existing installation +if [ -d "$APP_BASE/$ARCH-$VERSION" ]; then + echo "TBB version $VERSION for $ARCH already installed" + exit 1 +fi + +# Temp folder +mkdir -p $TEMP + +# Download +wget -c $BASE_URL/$FILE -O $DL/$FILE || exit 1 +wget -c $BASE_URL/$SIGN -O $DL/$SIGN || exit 1 + +# Check signature +gpg --verify $TEMP/$SIGN $TEMP/$FILE || exit 1 + +# Unpack +( cd $TEMP && tar xf $DL/$FILE ) || exit 1 + +# Move and symlink +mv $TEMP/tor-browser_$LANG $APP_BASE/$ARCH-$VERSION +rm -rf $APP_BASE/$ARCH && \ +ln -sf $APP_BASE/$ARCH-$VERSION $APP_BASE/$ARCH + +# Cleanup +rm -rf $TEMP |