-
Notifications
You must be signed in to change notification settings - Fork 115
/
setup.sh
executable file
·67 lines (53 loc) · 2.54 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -e
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# Prevent interactive prompts that would interrup the installation
export DEBIAN_FRONTEND=noninteractive
# code build tools
sudo apt-get update -y
sudo apt-get install -y coreutils clang llvm jq curl gcc xz-utils sudo pkg-config \
unzip libc6-dev make libssl-dev python3 cmake protobuf-compiler libprotobuf-dev
# Docker: do not replace existing installation to avoid distrupting running containers
if ! command -v docker &> /dev/null
then
# Install Docker from linux distro maintaners
echo "docker not found. You will need to install it. Visit https://www.docker.com/get-started"
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# install brew package manager
if ! which brew >/dev/null 2>&1; then
bash -c "`curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh`"
fi
# install additional packages
brew update
brew install coreutils gnu-tar jq curl llvm gnu-sed cmake protobuf || :
echo "It is recommended to setup Docker desktop from: https://www.docker.com/products/docker-desktop"
echo "It is also recommended to install qemu emulators with following command:"
echo "docker run --privileged --rm tonistiigi/binfmt --install all"
fi
# If OS is supported will install build tools for rust and substrate.
# Skips installation of substrate and subkey
# old script trying to install package 'protobuf' which does not exist
# curl https://getsubstrate.io -sSf | bash -s -- --fast
# Install Rust toolchain since we no longer use getsubstrate.io script
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
rustup update
rustup update nightly
rustup install nightly-2022-11-15
rustup target add wasm32-unknown-unknown --toolchain nightly-2022-11-15
rustup component add --toolchain nightly-2022-11-15 clippy
rustup component add rustfmt
# Install substrate keychain tool
# You can use docker instead https://github.com/paritytech/substrate/tree/master/bin/utils/subkey#run-in-a-container
# cargo install --force subkey --git https://github.com/paritytech/substrate --version ^2.0.2 --locked
# Volta nodejs, npm, yarn tools manager
if ! [[ $1 == "--no-volta" ]]; then
curl https://get.volta.sh | bash
# source env variables added by Volta
source ~/.bash_profile || source ~/.profile || source ~/.bashrc || :
volta install node
volta install yarn
volta install npx
fi
echo "You may need to open a new terminal/shell session to make newly installed tools available."