2023-02-24 19:45:48 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Installs Solc and Geth binaries
|
2023-02-25 14:12:29 +00:00
|
|
|
# Note: intended for use only with CI (x86_64 Ubuntu, MacOS or Windows)
|
2023-02-24 19:45:48 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
GETH_BUILD=${GETH_BUILD:-"1.11.2-73b01f40"}
|
|
|
|
SOLC_VERSION=${SOLC_VERSION:-"0.8.19"}
|
|
|
|
|
2023-02-25 14:12:29 +00:00
|
|
|
BIN_DIR=${BIN_DIR:-"$HOME/bin"}
|
|
|
|
BIN_DIR=$(realpath "$BIN_DIR")
|
2023-02-24 19:45:48 +00:00
|
|
|
|
2023-02-24 21:09:39 +00:00
|
|
|
PLATFORM="$(uname -s | awk '{print tolower($0)}')"
|
2023-02-25 14:12:29 +00:00
|
|
|
if [ "$PLATFORM" != "linux" ] && [ "$PLATFORM" != "darwin" ]; then
|
|
|
|
EXT=".exe"
|
2023-02-24 19:45:48 +00:00
|
|
|
fi
|
|
|
|
|
2023-02-25 14:12:29 +00:00
|
|
|
main() {
|
|
|
|
mkdir -p "$BIN_DIR"
|
|
|
|
cd "$BIN_DIR"
|
|
|
|
export PATH="$BIN_DIR:$PATH"
|
|
|
|
if [ "$GITHUB_PATH" ]; then
|
|
|
|
echo "$BIN_DIR" >> "$GITHUB_PATH"
|
|
|
|
fi
|
|
|
|
|
|
|
|
install_geth &
|
|
|
|
install_solc &
|
|
|
|
wait
|
|
|
|
|
|
|
|
echo "Installed Geth:"
|
|
|
|
geth version
|
|
|
|
echo ""
|
|
|
|
echo "Installed Solc:"
|
|
|
|
solc --version
|
|
|
|
}
|
|
|
|
|
|
|
|
install_geth() {
|
|
|
|
case "$PLATFORM" in
|
|
|
|
linux|darwin)
|
|
|
|
GETH_ARCHIVE_NAME="geth-$PLATFORM-amd64-$GETH_BUILD"
|
|
|
|
curl "https://gethstore.blob.core.windows.net/builds/$GETH_ARCHIVE_NAME.tar.gz" | tar -xzvf -
|
|
|
|
mv -f "$GETH_ARCHIVE_NAME/geth" ./
|
|
|
|
rm -rf "$GETH_ARCHIVE_NAME"
|
|
|
|
chmod +x geth
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
GETH_ARCHIVE_NAME="geth-windows-amd64-$GETH_BUILD"
|
|
|
|
zip="$GETH_ARCHIVE_NAME.zip"
|
|
|
|
curl -o "$zip" "https://gethstore.blob.core.windows.net/builds/$zip"
|
|
|
|
unzip "$zip"
|
|
|
|
mv -f "$GETH_ARCHIVE_NAME/geth.exe" ./
|
|
|
|
rm -rf "$GETH_ARCHIVE_NAME" "$zip"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
install_solc() {
|
|
|
|
case "$PLATFORM" in
|
|
|
|
linux) SOLC_NAME="solc-static-linux";;
|
|
|
|
darwin) SOLC_NAME="solc-macos";;
|
|
|
|
*) SOLC_NAME="solc-windows.exe";;
|
|
|
|
esac
|
|
|
|
wget -q "https://github.com/ethereum/solidity/releases/download/v$SOLC_VERSION/$SOLC_NAME"
|
|
|
|
mv -f "$SOLC_NAME" "solc$EXT"
|
|
|
|
chmod +x "solc$EXT"
|
|
|
|
}
|
2023-02-24 23:20:42 +00:00
|
|
|
|
2023-02-25 14:12:29 +00:00
|
|
|
main
|