#!/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." $MAKE_ME_ROOT yum update -y $MAKE_ME_ROOT yum groupinstall -y "Development Tools" $MAKE_ME_ROOT yum install -y cmake openssl-devel git protobuf protobuf-compiler clang clang-devel 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 protobuf protobuf-compiler 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"