From 3358f31841d6b2a9dc9bde8ea3593e09e8ee0a2c Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Fri, 7 Sep 2018 01:00:20 +0800 Subject: [PATCH] as.sh support download from maven central repository. #3 --- bin/as.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/as.sh b/bin/as.sh index 7c726ec17..e8fd24310 100755 --- a/bin/as.sh +++ b/bin/as.sh @@ -21,8 +21,8 @@ ARTHAS_VERSION= ARTHAS_SCRIPT_VERSION=3.0.2 # arthas remote url -ARTHAS_REMOTE_VERSION_URL="https://alibaba.github.io/arthas/latest_version" -ARTHAS_REMOTE_DOWNLOAD_URL="http://arthas.io/mdtool" +ARTHAS_REMOTE_VERSION_URL="http://search.maven.org/solrsearch/select?q=g:%22com.taobao.arthas%22+AND+a:%22arthas-packaging%22" +ARTHAS_REMOTE_DOWNLOAD_URL="http://search.maven.org/classic/remotecontent?filepath=com/taobao/arthas/arthas-packaging" # update timeout(sec) SO_TIMEOUT=5 @@ -135,7 +135,7 @@ get_local_version() # get latest version from remote get_remote_version() { - curl -sLk --connect-timeout ${SO_TIMEOUT} "${ARTHAS_REMOTE_VERSION_URL}" + curl -sLk --connect-timeout ${SO_TIMEOUT} "${ARTHAS_REMOTE_VERSION_URL}" | sed 's/{.*latestVersion":"*\([0-9a-zA-Z\\.\\-]*\)"*,*.*}/\1/' } # make version format to comparable format like 000.000.(0){15} @@ -155,7 +155,8 @@ update_if_necessary() local temp_target_lib_dir="$TMP_DIR/temp_${update_version}_$$" local temp_target_lib_zip="${temp_target_lib_dir}/arthas-${update_version}-bin.zip" - local target_lib_dir="${ARTHAS_LIB_DIR}/${update_version}" + local target_lib_dir="${ARTHAS_LIB_DIR}/${update_version}/arthas" + mkdir -p ${target_lib_dir} # clean rm -rf ${temp_target_lib_dir} @@ -169,7 +170,7 @@ update_if_necessary() -#Lk \ --connect-timeout ${SO_TIMEOUT} \ -o ${temp_target_lib_zip} \ - "${ARTHAS_REMOTE_DOWNLOAD_URL}/${update_version}/arthas-${update_version}-bin.zip" \ + "${ARTHAS_REMOTE_DOWNLOAD_URL}/${update_version}/arthas-packaging-${update_version}-bin.zip" \ || return 1 # unzip arthas lib