install_auto_commercial.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. MIRROR=""
  3. if [ "$1" == "cn" ]; then
  4. MIRROR="https://mirrors.goproxyauth.com/"
  5. fi
  6. F="proxy-linux-amd64_commercial.tar.gz"
  7. set -e
  8. if [ -e /tmp/proxy ]; then
  9. rm -rf /tmp/proxy
  10. fi
  11. mkdir /tmp/proxy
  12. cd /tmp/proxy
  13. echo -e "\n>>> downloading ... $F\n"
  14. manual="https://snail007.goproxyauth.com/goproxy/manual/zh/"
  15. LAST_VERSION=$(curl --silent "${MIRROR}https://api.github.com/repos/snail007/goproxy/releases/latest" | grep -Po '"tag_name": *"\K.*?(?=")')
  16. wget -t 1 "${MIRROR}https://github.com/snail007/goproxy/releases/download/${LAST_VERSION}/$F"
  17. echo -e ">>> installing ... \n"
  18. # #install proxy
  19. tar zxvf $F >/dev/null 2>&1
  20. set +e
  21. killall -9 proxy >/dev/null 2>&1
  22. set -e
  23. cp -f proxy /usr/bin/
  24. chmod +x /usr/bin/proxy
  25. if [ ! -e /etc/proxy ]; then
  26. mkdir /etc/proxy
  27. cp blocked /etc/proxy
  28. cp direct /etc/proxy
  29. fi
  30. if [ ! -e /etc/proxy/proxy.crt ]; then
  31. cd /etc/proxy/
  32. proxy keygen -C proxy >/dev/null 2>&1
  33. fi
  34. rm -rf /tmp/proxy
  35. version=`proxy --version 2>&1`
  36. echo -e ">>> install done, thanks for using snail007/goproxy $version\n"
  37. echo -e ">>> install path /usr/bin/proxy\n"
  38. echo -e ">>> configuration path /etc/proxy\n"
  39. echo -e ">>> uninstall just exec : rm /usr/bin/proxy && rm -rf /etc/proxy\n"
  40. echo -e ">>> How to using? Please visit : $manual\n"