From 7cd77873d0ce1e5f8b43167a8009327cca4200c3 Mon Sep 17 00:00:00 2001 From: alexshliu <104080237+alexshliu@users.noreply.github.com> Date: Tue, 7 Mar 2023 21:30:31 +0800 Subject: [PATCH] fix(protocol): make download solc script can run outside the protocol dir (#13263) --- packages/protocol/scripts/download_solc.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/protocol/scripts/download_solc.sh b/packages/protocol/scripts/download_solc.sh index 9c5413ac91..20c7873391 100755 --- a/packages/protocol/scripts/download_solc.sh +++ b/packages/protocol/scripts/download_solc.sh @@ -2,12 +2,15 @@ set -e -mkdir -p bin && cd bin +protocol_dir=$(realpath "$(dirname $0)/..") +solc_bin=${protocol_dir}/bin/solc -if [ -f "solc" ]; then +if [ -f "${solc_bin}" ]; then exit 0 fi +mkdir -p "$(dirname ${solc_bin})" + VERSION=v0.8.18 if [ "$(uname)" = 'Darwin' ]; then @@ -19,6 +22,6 @@ else exit 1 fi -wget -O solc https://github.com/ethereum/solidity/releases/download/$VERSION/$SOLC_FILE_NAME +wget -O "${solc_bin}" https://github.com/ethereum/solidity/releases/download/$VERSION/$SOLC_FILE_NAME -chmod +x solc +chmod +x "${solc_bin}"