#!/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 [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 package if [ ! -e "$DL/$FILE" ]; then wget -c $BASE_URL/$FILE -O $DL/$FILE || exit 1 fi # Download signature if [ ! -e "$DL/$SIGN" ]; then wget -c $BASE_URL/$SIGN -O $DL/$SIGN || exit 1 fi # Check signature gpg --verify $TEMP/$SIGN $DL/$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