various fixes
[buildscripts] / tor-browser
index 7da0ebea028585471a3eadace318322ff315a8dd..69547ec31e77f08970e91104c6bfa1c087fc3713 100755 (executable)
@@ -21,7 +21,7 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
 # https://dist.torproject.org/torbrowser/
 
 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)
 
 
@@ -30,9 +30,10 @@ ver=$(curl -s https://dist.torproject.org/torbrowser/ \
 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
+new_timestamp=$(stat -c %Y $f) ||:
+if [[ $timestamp == $new_timestamp && -e /a/opt/tor-browser_en-US/Browser/start-tor-browser ]]; then
     # already installed
     exit 0
 fi