minor fixes
[buildscripts] / tor-browser
index b7f7de9902c5d3562eba1d888c51b94c5fb340f2..df4dd8c4533093799d790b21147a57f674071a0d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash -l
+#!/bin/bash
 # Copyright (C) 2016 Ian Kelling
 
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,8 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
+if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
 
 
 # stable version is shown on:
@@ -43,8 +42,8 @@ dl() {
   else
     timestamp=0
   fi
-  echo wget -N https://www.torproject.org/dist/torbrowser/$ver/$f
-  wget -N https://www.torproject.org/dist/torbrowser/$ver/$f || ret=$?
+  echo wget -nv -N https://www.torproject.org/dist/torbrowser/$ver/$f
+  wget -nv -N https://www.torproject.org/dist/torbrowser/$ver/$f || ret=$?
 }
 dl
 # 8 is return code for 404. for a new release, they might not have released to linux yet.
@@ -57,7 +56,21 @@ 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
+  tar Jxf $f
+
+  ## begin handlers customization
+  dest=/a/opt/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default/handlers.json
+  orig=/p/c/tor-handlers-orig.json
+  src=/p/c/tor-handlers.json
+  if diff -q $src $dest; then
+    echo "Error: handlers file changed. adjust based on upstream"
+    exit 1
+  fi
+  cp $src $dest
+  ## end handlers customization
+
+  cp /p/c/tor-user.js /a/opt/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default/user.js
+
 fi
 
 for x in tor-*.tar.xz; do
@@ -66,4 +79,3 @@ for x in tor-*.tar.xz; do
   [[ $x != $f ]] || continue
   command rm -f $x
 done
-s lnf /a/opt/tor-browser_en-US/Browser/start-tor-browser /usr/local/bin