forked from dfinity/internet-identity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·30 lines (24 loc) · 897 Bytes
/
bootstrap
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
#!/usr/bin/env bash
# install build dependencies (rustup + ic-wasm)
set -euo pipefail
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPTS_DIR/.."
function run() {
1>&2 echo "running $@"
rc=0 && "$@" || rc="$?"
if ! [ "$rc" -eq 0 ]
then
1>&2 echo "Bootstrap command failed: $@"
exit "$rc"
fi
}
rust_version=$(cat ./rust-toolchain.toml | sed -n 's/^channel[[:space:]]*=[[:space:]]"\(.*\)"/\1/p')
echo "using rust version '$rust_version'"
# here we set the toolchain to 'none' and rustup will pick up on ./rust-toolchain.toml
run curl --fail https://sh.rustup.rs -sSf | run sh -s -- -y --default-toolchain "none" --no-modify-path
echo "looking for ic-wasm 0.3.5"
if [[ ! "$(command -v ic-wasm)" || "$(ic-wasm --version)" != "ic-wasm 0.3.5" ]]
then
echo "installing ic-wasm 0.3.5"
run cargo install ic-wasm --version 0.3.5
fi