blob: 56098410724df93f3db618b2872ec2011055968f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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"
|