setup.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env bash
  2. set -e
  3. if [[ "$OSTYPE" == "linux-gnu" ]]; then
  4. # Prevent interactive prompts that would interrup the installation
  5. export DEBIAN_FRONTEND=noninteractive
  6. # code build tools
  7. sudo apt-get update
  8. sudo apt-get install -y coreutils clang llvm jq curl gcc xz-utils sudo pkg-config unzip libc6-dev make libssl-dev python
  9. # docker
  10. sudo apt-get install -y docker.io containerd runc
  11. # docker-compose
  12. sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  13. sudo chmod +x /usr/local/bin/docker-compose
  14. sudo ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose
  15. elif [[ "$OSTYPE" == "darwin"* ]]; then
  16. # install brew package manager
  17. if ! which brew >/dev/null 2>&1; then
  18. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  19. fi
  20. # install additional packages
  21. brew update
  22. brew install coreutils gnu-tar jq curl llvm || :
  23. echo "It is recommended to setup Docker desktop from: https://www.docker.com/products/docker-desktop"
  24. echo "It is also recommended to install qemu emulators with following command:"
  25. echo "docker run --privileged --rm tonistiigi/binfmt --install all"
  26. fi
  27. # If OS is supported will install build tools for rust and substrate.
  28. # Skips installation of substrate and subkey
  29. curl https://getsubstrate.io -sSf | bash -s -- --fast
  30. source ~/.cargo/env
  31. rustup install nightly-2021-02-20
  32. rustup target add wasm32-unknown-unknown --toolchain nightly-2021-02-20
  33. rustup component add rustfmt clippy
  34. # Install substrate keychain tool - install doesn't seem to work lately.
  35. # cargo install --force subkey --git https://github.com/paritytech/substrate --version 2.0.1 --locked
  36. # You can use docker instead https://github.com/paritytech/substrate/tree/master/bin/utils/subkey#run-in-a-container
  37. # Volta nodejs, npm, yarn tools manager
  38. curl https://get.volta.sh | bash
  39. # source env variables added by Volta
  40. source ~/.bash_profile || source ~/.profile || source ~/.bashrc || :
  41. volta install node@14
  42. volta install yarn
  43. volta install npx
  44. echo "You may need to open a new terminal/shell session to make newly installed tools available."