From 365a10ca5b1045ed4575cc630bb1e5adc0860363 Mon Sep 17 00:00:00 2001 From: sulenn <273409891@qq.com> Date: Fri, 3 Jul 2020 18:30:40 +0800 Subject: [PATCH] Adapt windows when use download_solc.sh to download solc (#23) --- .ci/integration_test.sh | 2 +- tools/download_solc.sh | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.ci/integration_test.sh b/.ci/integration_test.sh index c6d0faa5..a7dd6a63 100755 --- a/.ci/integration_test.sh +++ b/.ci/integration_test.sh @@ -221,7 +221,7 @@ integration_gm() LOG_INFO "generate hello_gm.go and build hello_gm done." bash build_chain.sh -l 127.0.0.1:4 -g -o nodes_gm - cp nodes_gm/127.0.0.1/sdk/* ./ + cp -r nodes_gm/127.0.0.1/sdk/* ./ bash nodes_gm/127.0.0.1/start_all.sh sed -i "s/SMCrypto=false/SMCrypto=true/g" config.toml sed -i "s#KeyFile=\".ci/0x83309d045a19c44dc3722d15a6abd472f95866ac.pem\"#KeyFile=\".ci/sm2p256v1_0x791a0073e6dfd9dc5e5061aebc43ab4f7aa4ae8b.pem\"#g" config.toml diff --git a/tools/download_solc.sh b/tools/download_solc.sh index c464dfb8..b2e083b9 100644 --- a/tools/download_solc.sh +++ b/tools/download_solc.sh @@ -4,6 +4,7 @@ install_path="${HOME}/.fisco" version="0.4.25" OS="linux" crypto= +extension= LOG_WARN() { @@ -33,10 +34,14 @@ exit 0 check_env() { if [ "$(uname)" == "Darwin" ];then OS="mac" - fi - if [ "$(uname -m)" != "x86_64" ];then + elif [ "$(uname -s)" == "Linux" ];then + OS="linux" + elif [ "$(uname -m)" != "x86_64" ];then LOG_WARN "We only offer x86_64 precompiled solc binary, your OS architecture is not x86_64. Please compile from source." exit 1 + else + OS="win" + extension=".exe" fi } @@ -61,17 +66,18 @@ main() if [ ! -f "${install_path}/solc-${version}${crypto}" ];then if curl -LO "${download_link}" ;then - tar -zxf "${package_name}" + tar -zxf "${package_name}" rm -rf "${package_name}" mkdir -p "${install_path}" - mv solc "${install_path}/solc-${version}${crypto}" else LOG_WARN "Download from ${download_link} failed, please retry." exit 1 fi + mv "solc${extension}" "${install_path}/solc-${version}${crypto}${extension}" + fi + if [ ! -f "./solc-${version}${crypto}" ];then + ln -s "${install_path}/solc-${version}${crypto}${extension}" "./solc-${version}${crypto}" fi - ln -s "${install_path}/solc-${version}${crypto}" "./solc-${version}${crypto}" - } print_result() @@ -88,4 +94,4 @@ print_result() parse_params "$@" check_env main -print_result +print_result \ No newline at end of file