Skip to content

Commit 566a35e

Browse files
committed
Add fast mode in bootstarp.sh
1 parent 4222a5d commit 566a35e

File tree

2 files changed

+57
-53
lines changed

2 files changed

+57
-53
lines changed

README.adoc

+7-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ Darwinia Network provides game developers the scalability, cross-chain interoper
5353
=== Hacking on Darwinia
5454

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

5859
==== Linux and Mac
5960

@@ -344,16 +345,14 @@ node-cli, node-executor, node-primitives, node-rpc, node-rpc-client, node-runtim
344345

345346
=== Environment
346347

347-
If you are using Ubuntu,
348-
you may use the `scripts/bootstrap.sh` to set up your develop environment.
349-
In this script, the nightly `Rust`, `cargo`, `rustfmt` will be installed,
348+
The `scripts/bootstrap.sh` help set up your develop environment.
349+
The nightly `Rust`, `cargo`, `rustfmt` will be installed,
350350
the git hooks will be set, and ready to code.
351+
352+
Besides, the script will install some essential packages depends on your OS,
353+
if you want to do it manually, use the `--fast` option to skip.
351354
We will appreciate your contribution.
352355

353-
If you are using different environment, you may copy the git hooks mannually.
354-
```
355-
$ cp .hooks/* .git/hooks
356-
```
357356
=== Contributing Guidelines
358357

359358
link:CONTRIBUTING.adoc[CONTRIBUTING.adoc]

scripts/bootstrap.sh

+50-45
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,56 @@
11
#!/usr/bin/env bash
2-
2+
#
33
# The script help you set up your develop envirnment
4+
#
5+
# --fast: fast mode will skip OS pacakge dependency, only install git hooks and Rust
6+
#
47

5-
if [[ "$OSTYPE" == "linux-gnu" ]]; then
6-
set -e
7-
if [ -f /etc/redhat-release ]; then
8-
echo "Redhat Linux detected, but current not support sorry."
9-
echo "Contribution is always welcome."
10-
exit 1
11-
elif [ -f /etc/SuSE-release ]; then
12-
echo "Suse Linux detected, but current not support sorry."
13-
echo "Contribution is always welcome."
14-
exit 1
15-
elif [ -f /etc/arch-release ]; then
16-
echo "Arch Linux detected."
17-
sudo pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 clang llvm rocksdb curl
18-
export OPENSSL_LIB_DIR="/usr/lib/openssl-1.0";
19-
export OPENSSL_INCLUDE_DIR="/usr/include/openssl-1.0"
20-
elif [ -f /etc/mandrake-release ]; then
21-
echo "Mandrake Linux detected, but current not support sorry."
22-
echo "Contribution is always welcome."
23-
exit 1
24-
elif [ -f /etc/debian_version ]; then
25-
echo "Ubuntu/Debian Linux detected."
26-
sudo apt-get -y update
27-
sudo apt-get install -y cmake pkg-config libssl-dev
28-
else
29-
echo "Unknown Linux distribution."
30-
echo "Contribution is always welcome."
31-
exit 1
32-
fi
33-
elif [[ "$OSTYPE" == "darwin"* ]]; then
34-
set -e
35-
echo "Mac OS (Darwin) detected."
36-
if ! which brew >/dev/null 2>&1; then
37-
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
38-
fi
39-
brew upgrade
40-
brew install openssl cmake llvm
41-
elif [[ "$OSTYPE" == "freebsd"* ]]; then
42-
echo "FreeBSD detected, but current not support sorry."
43-
echo "Contribution is always welcome."
44-
exit 1
45-
else
46-
echo "Unknown operating system."
47-
echo "Contribution is always welcome."
48-
exit 1
8+
if [[ "$1" != "--fast" ]]; then
9+
if [[ "$OSTYPE" == "linux-gnu" ]]; then
10+
set -e
11+
if [ -f /etc/redhat-release ]; then
12+
echo "Redhat Linux detected, but current not support sorry."
13+
echo "Contribution is always welcome."
14+
exit 1
15+
elif [ -f /etc/SuSE-release ]; then
16+
echo "Suse Linux detected, but current not support sorry."
17+
echo "Contribution is always welcome."
18+
exit 1
19+
elif [ -f /etc/arch-release ]; then
20+
echo "Arch Linux detected."
21+
sudo pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 clang llvm rocksdb curl
22+
export OPENSSL_LIB_DIR="/usr/lib/openssl-1.0";
23+
export OPENSSL_INCLUDE_DIR="/usr/include/openssl-1.0"
24+
elif [ -f /etc/mandrake-release ]; then
25+
echo "Mandrake Linux detected, but current not support sorry."
26+
echo "Contribution is always welcome."
27+
exit 1
28+
elif [ -f /etc/debian_version ]; then
29+
echo "Ubuntu/Debian Linux detected."
30+
sudo apt-get -y update
31+
sudo apt-get install -y cmake pkg-config libssl-dev
32+
else
33+
echo "Unknown Linux distribution."
34+
echo "Contribution is always welcome."
35+
exit 1
36+
fi
37+
elif [[ "$OSTYPE" == "darwin"* ]]; then
38+
set -e
39+
echo "Mac OS (Darwin) detected."
40+
if ! which brew >/dev/null 2>&1; then
41+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
42+
fi
43+
brew upgrade
44+
brew install openssl cmake llvm
45+
elif [[ "$OSTYPE" == "freebsd"* ]]; then
46+
echo "FreeBSD detected, but current not support sorry."
47+
echo "Contribution is always welcome."
48+
exit 1
49+
else
50+
echo "Unknown operating system."
51+
echo "Contribution is always welcome."
52+
exit 1
53+
fi
4954
fi
5055

5156
# Setup git hooks

0 commit comments

Comments
 (0)