forked from paritytech/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-substrate.sh
executable file
·89 lines (81 loc) · 3.03 KB
/
get-substrate.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# Copyright 2015-2020 Parity Technologies (UK) Ltd.
if [[ "$OSTYPE" == "linux-gnu" ]]; then
set -e
if [[ $(whoami) == "root" ]]; then
MAKE_ME_ROOT=
else
MAKE_ME_ROOT=sudo
fi
if [ -f /etc/redhat-release ]; then
echo "Redhat Linux detected."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
elif [ -f /etc/SuSE-release ]; then
echo "Suse Linux detected."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
elif [ -f /etc/arch-release ]; then
echo "Arch Linux detected."
$MAKE_ME_ROOT pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 pkgconf git clang
export OPENSSL_LIB_DIR="/usr/lib/openssl-1.0";
export OPENSSL_INCLUDE_DIR="/usr/include/openssl-1.0"
elif [ -f /etc/mandrake-release ]; then
echo "Mandrake Linux detected."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
elif [ -f /etc/debian_version ]; then
echo "Ubuntu/Debian Linux detected."
$MAKE_ME_ROOT apt update
$MAKE_ME_ROOT apt install -y cmake pkg-config libssl-dev git gcc build-essential git clang libclang-dev
else
echo "Unknown Linux distribution."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
set -e
echo "Mac OS (Darwin) detected."
if ! which brew >/dev/null 2>&1; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
brew update
brew install openssl cmake llvm
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "FreeBSD detected."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
else
echo "Unknown operating system."
echo "This OS is not supported with this script at present. Sorry."
echo "Please refer to https://github.com/paritytech/substrate for setup information."
exit 1
fi
if ! which rustup >/dev/null 2>&1; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
source ~/.cargo/env
rustup default stable
else
rustup update
rustup default stable
fi
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
if [[ "$1" == "--fast" ]]; then
echo "Skipped cargo install of 'substrate' and 'subkey'"
echo "You can install manually by cloning the https://github.com/paritytech/substrate repo,"
echo "and using cargo to install 'substrate' and 'subkey' from the repo path."
else
g=$(mktemp -d)
git clone https://github.com/paritytech/substrate "$g"
pushd "$g"
cargo install --force --path ./bin/node/cli #substrate
cargo install --force --path ./bin/utils/subkey subkey
popd
fi
echo "Run source ~/.cargo/env now to update environment"