]> gitweb.fluxo.info Git - scripts.git/commitdiff
Adding tor-browser-dl
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 3 Nov 2013 15:47:04 +0000 (13:47 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 3 Nov 2013 15:47:04 +0000 (13:47 -0200)
tor-browser
tor-browser-dl [new file with mode: 0755]

index 6ad669ecd676ba44d60eff1e1a2b0d402c1111b9..4944d4ef75b175aabd519359bfe6646bdee84ee5 100755 (executable)
@@ -2,4 +2,10 @@
 # Wrapper for the Tor Software Bundle
 #
 
-$HOME/apps/tor-browser/`uname -m`/start-tor-browser
+ARCH="`uname -m`"
+
+if [ "$ARCH" == "i386" ]; then
+  ARCH="i686"
+fi
+
+$HOME/apps/tor-browser/$ARCH/start-tor-browser
diff --git a/tor-browser-dl b/tor-browser-dl
new file mode 100755 (executable)
index 0000000..cc7449b
--- /dev/null
@@ -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