Skip to content

Commit

Permalink
Add fast mode in bootstarp.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
yanganto committed Jan 10, 2020
1 parent 3833d01 commit b5510d5
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 52 deletions.
14 changes: 7 additions & 7 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ Darwinia Network provides game developers the scalability, cross-chain interoper
=== Hacking on Darwinia

If you'd actually like to hack on Darwinia, you can just grab the source code and
build it. Ensure you have Rust and the support software installed:
build it. We also provide the script to help you setup your developing environment in bellow sections.
Please ensure you have Rust and the support software installed:

==== Linux and Mac

Expand Down Expand Up @@ -341,14 +342,13 @@ node-cli, node-executor, node-primitives, node-rpc, node-rpc-client, node-runtim

=== Environment

If you are using Ubuntu,
you may use the `scripts/bootstrap.sh` to set up your develop environment.
In this script, the nightly `Rust`, `cargo`, `rustfmt` will be installed,
The `scripts/bootstrap.sh` help set up your develop environment.
The nightly `Rust`, `cargo`, `rustfmt` will be installed,
the git hooks will be set, and ready to code.
We will appreciate your contribution.

If you are using different environment, you may copy the git hooks mannually.
`$ cp .hooks/* .git/hooks`
Besides, the script will install some essential packages depends on your OS,
if you want to do it manually, use the `--fast` option to skip.
We will appreciate your contribution.

=== Contributing Guidelines

Expand Down
95 changes: 50 additions & 45 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,51 +1,56 @@
#!/usr/bin/env bash

#
# The script help you set up your develop envirnment
#
# --fast: fast mode will skip OS pacakge dependency, only install git hooks and Rust
#

if [[ "$OSTYPE" == "linux-gnu" ]]; then
set -e
if [ -f /etc/redhat-release ]; then
echo "Redhat Linux detected, but current not support sorry."
echo "Contribution is always welcome."
exit 1
elif [ -f /etc/SuSE-release ]; then
echo "Suse Linux detected, but current not support sorry."
echo "Contribution is always welcome."
exit 1
elif [ -f /etc/arch-release ]; then
echo "Arch Linux detected."
sudo pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 clang llvm rocksdb curl
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, but current not support sorry."
echo "Contribution is always welcome."
exit 1
elif [ -f /etc/debian_version ]; then
echo "Ubuntu/Debian Linux detected."
sudo apt-get -y update
sudo apt-get install -y cmake pkg-config libssl-dev
else
echo "Unknown Linux distribution."
echo "Contribution is always welcome."
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
set -e
echo "Mac OS (Darwin) detected."
if ! which brew >/dev/null 2>&1; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew upgrade
brew install openssl cmake llvm
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "FreeBSD detected, but current not support sorry."
echo "Contribution is always welcome."
exit 1
else
echo "Unknown operating system."
echo "Contribution is always welcome."
exit 1
if [[ "$1" != "--fast" ]]; then
if [[ "$OSTYPE" == "linux-gnu" ]]; then
set -e
if [ -f /etc/redhat-release ]; then
echo "Redhat Linux detected, but current not support sorry."
echo "Contribution is always welcome."
exit 1
elif [ -f /etc/SuSE-release ]; then
echo "Suse Linux detected, but current not support sorry."
echo "Contribution is always welcome."
exit 1
elif [ -f /etc/arch-release ]; then
echo "Arch Linux detected."
sudo pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 clang llvm rocksdb curl
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, but current not support sorry."
echo "Contribution is always welcome."
exit 1
elif [ -f /etc/debian_version ]; then
echo "Ubuntu/Debian Linux detected."
sudo apt-get -y update
sudo apt-get install -y cmake pkg-config libssl-dev
else
echo "Unknown Linux distribution."
echo "Contribution is always welcome."
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
set -e
echo "Mac OS (Darwin) detected."
if ! which brew >/dev/null 2>&1; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew upgrade
brew install openssl cmake llvm
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "FreeBSD detected, but current not support sorry."
echo "Contribution is always welcome."
exit 1
else
echo "Unknown operating system."
echo "Contribution is always welcome."
exit 1
fi
fi

# Setup git hooks
Expand Down

0 comments on commit b5510d5

Please sign in to comment.