setup.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 docker-compose containerd runc
  11. elif [[ "$OSTYPE" == "darwin"* ]]; then
  12. # install brew package manager
  13. if ! which brew >/dev/null 2>&1; then
  14. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  15. fi
  16. # install additional packages
  17. brew update
  18. brew install coreutils gnu-tar jq curl llvm || :
  19. echo "It is recommended to setup Docker desktop from: https://www.docker.com/products/docker-desktop"
  20. echo "It is also recommended to install qemu emulators with following command:"
  21. echo "docker run --privileged --rm tonistiigi/binfmt --install all"
  22. fi
  23. # If OS is supported will install build tools for rust and substrate.
  24. # Skips installation of substrate and subkey
  25. curl https://getsubstrate.io -sSf | bash -s -- --fast
  26. source ~/.cargo/env
  27. rustup install nightly-2021-02-20
  28. rustup target add wasm32-unknown-unknown --toolchain nightly-2021-02-20
  29. rustup component add rustfmt clippy
  30. # Install substrate keychain tool - install doesn't seem to work lately.
  31. # cargo install --force subkey --git https://github.com/paritytech/substrate --version 2.0.1 --locked
  32. # You can use docker instead https://github.com/paritytech/substrate/tree/master/bin/utils/subkey#run-in-a-container
  33. # Volta nodejs, npm, yarn tools manager
  34. curl https://get.volta.sh | bash
  35. # source env variables added by Volta
  36. source ~/.bash_profile || source ~/.profile || source ~/.bashrc || :
  37. volta install node@14
  38. volta install yarn
  39. volta install npx
  40. echo "You may need to open a new terminal/shell session to make newly installed tools available."