# Additional parameters
DIST="https://dist.torproject.org/torbrowser/"
WORK="`mktemp -d`" || exit 1
+ARCH="`uname -m`"
# Determine the application name
if echo $BASENAME | grep -q 'tor-browser-alpha'; then
APP="tor-browser"
fi
+# Determine architecture
+if [ "$ARCH" == "i386" ]; then
+ ARCH="linux32"
+elif [ "$ARCH" == "i686" ]; then
+ ARCH="linux32"
+elif [ "$ARCH" == "x86_64" ]; then
+ ARCH="linux64"
+fi
+
# Include basic functions
. $LIB/trashman/functions || exit 1
# Build the URL and filename strings
URL="${DIST}/${VERSION}/"
-FILE="tor-browser-linux64-${VERSION}_ALL.tar.xz"
+FILE="tor-browser-${ARCH}-${VERSION}_ALL.tar.xz"
# Download
wget "$URL/$FILE" -O $WORK/$FILE || exit 1
tar xvf $WORK/$FILE -C $WORK || exit 1
# Install
-mkdir -p $HOME/.local/share || exit 1
-cd $HOME/.local/share || exit 1
-rm -rf $APP || exit 1
-mv $WORK/tor-browser $APP || exit 1
-rm -rf $WORK || exit 1
+mkdir -p $HOME/.local/share || exit 1
+cd $HOME/.local/share || exit 1
+rm -rf $APP || exit 1
+mv $WORK/tor-browser $APP/$ARCH || exit 1
+rm -rf $WORK || exit 1
# Create symlink to scripts
-mkdir -p $HOME/.local/bin || exit 1
-cd $HOME/.local/bin || exit 1
-ln -sf $HOME/.local/share/$APP/Browser/start-tor-browser $APP || exit 1
+mkdir -p $HOME/.local/bin || exit 1
+cd $HOME/.local/bin || exit 1
+ln -sf $HOME/.local/share/$APP/${ARCH}/Browser/start-tor-browser $APP-${ARCH} || exit 1
+
+# Remove old symlink to the Tor Browser script
+rm -f $HOME/.local/bin/$APP
# Done
-trashman_installed_at $HOME/.local/share/$APP
-trashman_run_with $HOME/.local/bin/$APP
+trashman_installed_at $HOME/.local/share/$APP/$ARCH
+trashman_run_with $HOME/.local/bin/$APP-$ARCH