env.sh 646 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. set -e
  3. if [ ! -f "build/env.sh" ]; then
  4. echo "$0 must be run from the root of the repository."
  5. exit 2
  6. fi
  7. # Create fake Go workspace if it doesn't exist yet.
  8. workspace="$PWD/build/_workspace"
  9. root="$PWD"
  10. ethdir="$workspace/src/github.com/ethereum"
  11. if [ ! -L "$ethdir/go-ethereum" ]; then
  12. mkdir -p "$ethdir"
  13. cd "$ethdir"
  14. ln -s ../../../../../. go-ethereum
  15. cd "$root"
  16. fi
  17. # Set up the environment to use the workspace.
  18. GOPATH="$workspace"
  19. export GOPATH
  20. # Run the command inside the workspace.
  21. cd "$ethdir/go-ethereum"
  22. PWD="$ethdir/go-ethereum"
  23. # Launch the arguments with the configured environment.
  24. exec "$@"