install_auto.sh 1.2 KB

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