# stable version is shown on:
# https://dist.torproject.org/torbrowser/
+# except sometimes you get a new stable before it's
+# officially released, which is ok by me. for example,
+# right now, it has 6.5.2, but stable is 6.5.1.
+# we exclude verions with letters, as that seems to
+# be a relatively reliable indication of alpha/beta releases.
ver=$(curl -s https://dist.torproject.org/torbrowser/ \
- | sed -rn 's/.*href="([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' \
+ | sed -rn 's#.*href="([0-9]+\.[0-9]+[.0-9]*)/.*#\1#p' \
| sort -Vr | head -n 1)
cd /a/opt
f=tor-browser-linux64-${ver}_en-US.tar.xz
-timestamp=$(stat -c %Y $f)
+timestamp=$(stat -c %Y $f) ||:
wget -N https://www.torproject.org/dist/torbrowser/$ver/$f
-if [[ $timestamp == $(stat -c %Y $f) && -e /a/opt/tor-browser_en-US/Browser/start-tor-browser ]]; then
- # already installed
- exit 0
+new_timestamp=$(stat -c %Y $f) ||:
+if [[ $timestamp != $new_timestamp || ! -e /a/opt/tor-browser_en-US/Browser/start-tor-browser ]]; then
+ # not already installed
+ rm -rf tor-browser_en-US
+ ex $f
fi
-rm -rf tor-browser_en-US
-ex $f
for x in tor-*.tar.xz; do
# cleanup old tarballs