From 558748dab27377c4bf3d79d1f733b0579d9e9e05 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 2 Mar 2022 19:36:30 +0100 Subject: [PATCH] build(update_appup): only download package if not exist --- scripts/update_appup.escript | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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),