-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathbuild.sh
executable file
·40 lines (34 loc) · 1.02 KB
/
build.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
#!/bin/bash
# Update this when doing a rustup.
EXPECTED_HASH="2782e8f8fcefdce77c5e0dd0846c15c4c5103d84"
EXPECTED_DATE="2017-01-12"
CURRENT_HASH=`rustc --version -v|grep commit-hash|cut -f 2 -d ' '`
install_rustc() {
echo "Checking for rustup"
RUSTUP=`which rustup`
if [[ "$RUSTUP" == "" ]]; then
echo "Installing rustup"
curl https://sh.rustup.rs -sSf | sh
RUSTUP=`which rustup`
fi
$RUSTUP install nightly-$EXPECTED_DATE
$RUSTUP override set nightly-$EXPECTED_DATE
}
prompt_rust_install() {
while true; do
read -p "Do you wish to install the correct Rustc version? [y/n] " yn
case $yn in
[Yy]* ) install_rustc; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
}
if [ "$CURRENT_HASH" != "$EXPECTED_HASH" ]; then
echo "You need Rustc nightly from $EXPECTED_DATE to build."
echo "Found $CURRENT_HASH but expected $EXPECTED_HASH"
prompt_rust_install
fi
echo "Building..."
set -e -x
cargo build