setup.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env bash
  2. set -e
  3. if [[ "$OSTYPE" == "linux-gnu" ]]; then
  4. # code build tools
  5. sudo apt-get update
  6. sudo apt-get install -y coreutils clang jq curl gcc xz-utils sudo pkg-config unzip clang libc6-dev-i386 make libssl-dev python
  7. # docker
  8. sudo apt-get install -y docker.io docker-compose containerd runc
  9. elif [[ "$OSTYPE" == "darwin"* ]]; then
  10. # install brew package manager
  11. if ! which brew >/dev/null 2>&1; then
  12. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  13. fi
  14. # install additional packages
  15. brew update
  16. brew install b2sum gnu-tar jq curl
  17. echo "It is recommended to setup Docker desktop from: https://www.docker.com/products/docker-desktop"
  18. fi
  19. # If OS is supported will install build tools for rust and substrate.
  20. # Skips installation of substrate and subkey
  21. curl https://getsubstrate.io -sSf | bash -s -- --fast
  22. source ~/.cargo/env
  23. rustup component add rustfmt clippy
  24. # Current version of substrate requires an older version of nightly toolchain
  25. # to successfully compile the WASM runtime. We force install because rustfmt package
  26. # is not available for this nightly version.
  27. rustup install nightly-2020-05-23 --force
  28. rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-23
  29. # Latest clippy linter which comes with 1.47.0 fails on some subtrate modules
  30. # Also note combination of newer versions of toolchain with the above nightly
  31. # toolchain to build wasm seems to fail.
  32. # So we need to stick with an older version until we update substrate
  33. rustup install 1.46.0
  34. rustup default 1.46.0
  35. # Volta nodejs, npm, yarn tools manager
  36. curl https://get.volta.sh | bash
  37. # source env variables added by Volta
  38. source source ~/.bash_profile || ~/.profile || source ~/.bashrc || :
  39. volta install node@12
  40. volta install yarn
  41. volta install npx
  42. echo "Starting new terminal/shell session to make newly installed tools available."
  43. exec bash -l