diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-09-18 16:36:19 -0300 |
---|---|---|
committer | Silvio Rhatto <user@example.org> | 2014-09-18 16:36:19 -0300 |
commit | b9a596c1d2fceb73564eacdc49b1448873c8fe1f (patch) | |
tree | b64157909c6316fb0bd71445c9688f021c7f62ab /tor-browser-dl | |
download | downloaders-b9a596c1d2fceb73564eacdc49b1448873c8fe1f.tar.gz downloaders-b9a596c1d2fceb73564eacdc49b1448873c8fe1f.tar.bz2 |
Initial import
Diffstat (limited to 'tor-browser-dl')
-rwxr-xr-x | tor-browser-dl | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tor-browser-dl b/tor-browser-dl new file mode 100755 index 0000000..5609841 --- /dev/null +++ b/tor-browser-dl @@ -0,0 +1,70 @@ +#!/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/$VERSION" + +# Syntax check +if [ -z "$VERSION" ]; then + echo "usage: $BASENAME <version> [arch] [lang]" + echo "example: $BASENAME 2.3.25-14-dev linux64 en-US" + exit 1 +fi + +# Set arch +if [ -z "$ARCH" ]; then + ARCH="linux64" +fi + +# Set lang +if [ -z "$LANG" ]; then + LANG="en-US" +fi + +# Set file names +FILE="tor-browser-$ARCH-$VERSION"_"$LANG.tar.xz" +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 $DL/$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 && \ +( cd $APP_BASE && ln -sf $ARCH-$VERSION $ARCH ) + +# Cleanup +rm -rf $TEMP +echo "Please check and cleanup old versions at $APP_BASE" |