install.sh 574 B

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