install.sh 779 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. GO_AMD64=https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz
  3. GO_X86=https://storage.googleapis.com/golang/go1.5.1.linux-386.tar.gz
  4. ARCH=$(uname -m)
  5. GO_CUR=${GO_AMD64}
  6. if [ "$ARCH" == "i686" ] || [ "$ARCH" == "i386" ]; then
  7. GO_CUR=${GO_X86}
  8. fi
  9. function git_not_installed {
  10. git --version 2>&1 >/dev/null
  11. GIT_IS_AVAILABLE=$?
  12. return $GIT_IS_AVAILABLE
  13. }
  14. if [ git_not_installed ]; then
  15. apt-get install git -y
  16. fi
  17. if [ -z "$GOPATH" ]; then
  18. curl -o go_latest.tar.gz ${GO_CUR}
  19. tar -C /usr/local -xzf go_latest.tar.gz
  20. rm go_latest.tar.gz
  21. export PATH=$PATH:/usr/local/go/bin
  22. mkdir /v2ray
  23. export GOPATH=/v2ray
  24. fi
  25. go get github.com/v2ray/v2ray-core
  26. go build -o $GOPATH/bin/v2ray -compiler gc github.com/v2ray/v2ray-core/release/server