diff --git a/scripts/update-appup.sh b/scripts/update-appup.sh index e1ef0c3c0..db0759695 100755 --- a/scripts/update-appup.sh +++ b/scripts/update-appup.sh @@ -41,18 +41,20 @@ shift 1 ESCRIPT_ARGS="$*" SYSTEM="${SYSTEM:-$(./scripts/get-distro.sh)}" -ARCH="${ARCH:-$(uname -m)}" -case "$ARCH" in - x86_64) - ARCH='amd64' - ;; - aarch64) - ARCH='arm64' - ;; - arm*) - ARCH=arm - ;; -esac +if [ -z "${ARCH:-}" ]; then + UNAME="$(uname -m)" + case "$UNAME" in + x86_64) + ARCH='amd64' + ;; + aarch64) + ARCH='arm64' + ;; + arm*) + ARCH='arm' + ;; + esac +fi PACKAGE_NAME="${PROFILE}-${SYSTEM}-${PREV_VERSION}-${ARCH}.zip" DOWNLOAD_URL="https://www.emqx.com/downloads/${DIR}/v${PREV_VERSION}/${PACKAGE_NAME}" diff --git a/scripts/update_appup.escript b/scripts/update_appup.escript index 5bc709267..b12012719 100755 --- a/scripts/update_appup.escript +++ b/scripts/update_appup.escript @@ -171,9 +171,11 @@ download_prev_release(Tag, #{binary_rel_url := {ok, URL0}, clone_url := Repo}) - BaseDir = "/tmp/emqx-baseline-bin/", Dir = filename:basename(Repo, ".git") ++ [$-|Tag], Filename = filename:join(BaseDir, Dir), - Script = "echo \"Download: ${OUTFILE}\" && - mkdir -p ${OUTFILE} && - curl -f -L -o ${OUTFILE}.zip ${URL} && + Script = "mkdir -p ${OUTFILE} && + if [ ! -f \"${OUTFILE}.zip\" ]; then \ + echo \"Download: ${OUTFILE}\" && \ + curl -f -L -o \"${OUTFILE}.zip\" \"${URL}\"; \ + fi && unzip -q -n -d ${OUTFILE} ${OUTFILE}.zip", Env = [{"TAG", Tag}, {"OUTFILE", Filename}, {"URL", URL}], bash(Script, Env),