make.bash 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env sh
  2. set -e
  3. BASE_DIR=$( cd "$(dirname "$0")" ; pwd -P )
  4. cd $BASE_DIR
  5. if [ ! -f make.bash ]; then
  6. echo "make.bash must be run from $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/Server"
  7. exit 1
  8. fi
  9. build_for_linux () {
  10. echo "Getting project dependencies (via go get) for Linux. Parameter is: '$1'"
  11. GOOS=linux GOARCH=amd64 go get -d -v ./...
  12. if [ $? != 0 ]; then
  13. echo "...'go get' failed, exiting"
  14. exit $?
  15. fi
  16. GOOS=linux GOARCH=amd64 go build --ldflags '-linkmode external -extldflags "-static"' -o psiphond main.go
  17. if [ $? != 0 ]; then
  18. echo "...'go build' failed, exiting"
  19. exit $?
  20. fi
  21. chmod 555 psiphond
  22. if [ "$1" == "generate" ]; then
  23. ./psiphond --ipaddress 0.0.0.0 --protocol SSH:22 --protocol OSSH:53 --web 80 generate
  24. # Temporary:
  25. # - Disable syslog integration until final strategy is chosen
  26. # - Disable Fail2Ban integration until final strategy is chosen
  27. sed -i 's/"SyslogFacility": "user"/"SyslogFacility": ""/' psiphond.config
  28. sed -i 's/"Fail2BanFormat": "Authentication failure for psiphon-client from %s"/"Fail2BanFormat": ""/' psiphond.config
  29. chmod 666 psiphond.config
  30. chmod 666 psiphond-traffic-rules.config
  31. chmod 666 server-entry.dat
  32. fi
  33. }
  34. build_for_linux generate
  35. echo "Done"