From: AJ ONeal Date: Sun, 3 May 2020 04:37:31 +0000 (+0000) Subject: failsafe optional var, template baserul for downloads X-Git-Url: https://git.josue.xyz/?p=webi-installers%2F.git;a=commitdiff_plain;h=d117e5c2aeaf6dea89b487324f3acc6a12e75ce2 failsafe optional var, template baserul for downloads --- diff --git a/_common/normalize.js b/_common/normalize.js index 8e984ff..6a0830f 100644 --- a/_common/normalize.js +++ b/_common/normalize.js @@ -67,6 +67,10 @@ function normalize(all) { rel.ext = exts[0]; } } + + if (all.download) { + rel.download = all.download.replace(/{{ download }}/, rel.download); + } }); return all; } diff --git a/golang/golang.bash b/golang/golang.bash index a53c97a..44f0176 100644 --- a/golang/golang.bash +++ b/golang/golang.bash @@ -50,7 +50,7 @@ WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-go.XXXXXXXX)"} # The WEBI bootstrap will define these # but each script should be testable in its own right -if [ -z "${WEBI_PKG_URL}" ]; then +if [ -z "${WEBI_PKG_URL:-}" ]; then release_tab="${WEBI_HOST}/api/releases/go@${WEBI_VERSION:-}.csv?os=$(uname -s)&arch=$(uname -m)&ext=tar&limit=1" WEBI_CSV=$(curl -fsSL "$release_tab" -H "User-Agent: $(uname -a)") WEBI_CHANNEL=$(echo $WEBI_TAB | cut -d ',' -f 3) diff --git a/rg/rg.bash b/rg/rg.bash index 577e029..f7501bd 100644 --- a/rg/rg.bash +++ b/rg/rg.bash @@ -34,7 +34,7 @@ WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-ripgrep.XXXXXXXX)"} # The WEBI bootstrap will define these # but each script should be testable in its own right -if [ -z "${WEBI_PKG_URL}" ]; then +if [ -z "${WEBI_PKG_URL:-}" ]; then release_tab="${WEBI_HOST}/api/releases/ripgrep@${WEBI_VERSION:-}.csv?os=$(uname -s)&arch=$(uname -m)&ext=tar&limit=1" WEBI_CSV=$(curl -fsSL "$release_tab" -H "User-Agent: $(uname -a)") WEBI_CHANNEL=$(echo $WEBI_TAB | cut -d ',' -f 3)