update_tor-browser.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. # Set superuser privileges command if not set
  7. if [[ -z $su ]]; then
  8. export su="sudo"
  9. fi
  10. #https://www.torproject.org/download/
  11. mkdir -p ~/bin
  12. cd ~/bin || return
  13. export TOR_BROWSER_VERSION=$(curl --silent "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=tor-browser" | grep "pkgver=" | sed 's/pkgver=//' | sed "s/'//g")
  14. export TOR_BROWSER_FILENAME="tor-browser-linux64-${TOR_BROWSER_VERSION}_en-US.tar.xz"
  15. export TOR_BROWSER_DOWNLOAD_URL="https://www.torproject.org/dist/torbrowser/${TOR_BROWSER_VERSION}/${TOR_BROWSER_FILENAME}"
  16. $su apt-get update -qq
  17. $su apt-get install -qq -y curl
  18. # Remove previous file
  19. rm -rf tor-browser-linux64-*_en-US.tar.xz
  20. # Download new version
  21. curl -OL "${TOR_BROWSER_DOWNLOAD_URL}"
  22. # Remove previous directory
  23. rm -rf tor-browser_en-US
  24. # Remove previous symlink
  25. rm -f tor-browser
  26. # Extract new version
  27. tar -xvf ${TOR_BROWSER_FILENAME}
  28. # Create new symlink
  29. ln -s ~/bin/tor-browser_en-US/Browser/start-tor-browser ~/bin/tor-browser