forked from raiden-network/raiden
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdownload_solc.sh
executable file
·59 lines (45 loc) · 1.13 KB
/
download_solc.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -e
fail() {
if [[ $- == *i* ]]; then
red=`tput setaf 1`
reset=`tput sgr0`
echo "${red}==> ${@}${reset}"
fi
exit 1
}
info() {
if [[ $- == *i* ]]; then
blue=`tput setaf 4`
reset=`tput sgr0`
echo "${blue}${@}${reset}"
fi
}
success() {
if [[ $- == *i* ]]; then
green=`tput setaf 2`
reset=`tput sgr0`
echo "${green}${@}${reset}"
fi
}
warn() {
if [[ $- == *i* ]]; then
yellow=`tput setaf 3`
reset=`tput sgr0`
echo "${yellow}${@}${reset}"
fi
}
[ -z "${SOLC_URL}" ] && fail 'missing SOLC_URL'
[ -z "${SOLC_VERSION}" ] && fail 'missing SOLC_VERSION'
if [ ! -x $HOME/.bin/solc-${SOLC_VERSION} ]; then
mkdir -p $HOME/.bin
curl -L $SOLC_URL > $HOME/.bin/solc-${SOLC_VERSION}
chmod 775 $HOME/.bin/solc-${SOLC_VERSION}
success "solc ${SOLC_VERSION} installed"
else
info 'using cached solc'
fi
# always recreate the symlink since we dont know if it's pointing to a different
# version
[ -h $HOME/.bin/solc ] && unlink $HOME/.bin/solc
ln -s $HOME/.bin/solc-${SOLC_VERSION} $HOME/.bin/solc