aboutsummaryrefslogtreecommitdiff
path: root/share/hoarder/tor-browser/unix/linux/install
diff options
context:
space:
mode:
Diffstat (limited to 'share/hoarder/tor-browser/unix/linux/install')
-rwxr-xr-xshare/hoarder/tor-browser/unix/linux/install36
1 files changed, 30 insertions, 6 deletions
diff --git a/share/hoarder/tor-browser/unix/linux/install b/share/hoarder/tor-browser/unix/linux/install
index 2577572..c8a0f7b 100755
--- a/share/hoarder/tor-browser/unix/linux/install
+++ b/share/hoarder/tor-browser/unix/linux/install
@@ -4,21 +4,45 @@
#
# Parameters
+BASENAME="$0"
SHARE="$1"
LIB="$2"
+# Additional parameters
+DIST="https://dist.torproject.org/torbrowser/"
+WORK="`mktemp -d`" || exit 1
+
+# Determine the application name
+if echo $BASENAME | grep -q 'tor-browser-alpha'; then
+ APP="tor-browser-alpha"
+else:
+ APP="tor-browser"
+fi
+
# Include basic functions
. $LIB/trashman/functions || exit 1
# Requirements
-trashman_require wget
+trashman_require wget lynx gpg tar xz
-# Additional parameters
-APP="tor-browser"
-VERSION="12.5.2"
-URL="https://www.torproject.org/dist/torbrowser/${VERSION}/"
+# Determine the current version filter
+if [ "$APP" = "tor-browser" ]; then
+ VERSION_FILTER="-v"
+fi
+
+# Try to get the current version
+# Use a large (10000) number for grep to make sure we get all available versions
+VERSION="`LC_ALL=C lynx -dump https://dist.torproject.org/torbrowser/ 2> /dev/null | grep -A 10000 References | grep -e 'torbrowser' | grep -v '?' | sort -V | sed -e 's|^.*dist.torproject.org/torbrowser/||' -e 's|/||g' | grep $VERSION_FILTER a | tail -n 1`"
+
+# Check for available versions
+if [ -z "$VERSION" ]; then
+ trashman_echo "error determining the available $APP version, aborting"
+ exit 1
+fi
+
+# Build the URL and filename strings
+URL="${DIST}/${VERSION}/"
FILE="tor-browser-linux64-${VERSION}_ALL.tar.xz"
-WORK="`mktemp -d`" || exit 1
# Download
wget "$URL/$FILE" -O $WORK/$FILE || exit 1