From 1c063afc5fb231005785f1eeec43a03b39727d35 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Thu, 12 Mar 2020 15:12:32 +0000 Subject: [PATCH] scripts: set a default path to the yq binary Use the path where `install-yq.sh` installs `yq` as the default path to the `yq` binary in `lib.sh`. Install `yq` in the default path if it doesn't exist. fixes #429 Signed-off-by: Julio Montes --- scripts/lib.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index d585da4072..9f361358b4 100644 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -382,8 +382,8 @@ RUN ln -sf /usr/bin/g++ /bin/musl-g++ detect_go_version() { info "Detecting agent go version" - typeset -r yq=$(command -v yq || command -v ${GOPATH}/bin/yq) - if [ -z "$yq" ]; then + typeset yq=$(command -v yq || command -v ${GOPATH}/bin/yq || echo "${GOPATH}/bin/yq") + if [ ! -f "$yq" ]; then source "$yq_file" fi @@ -428,8 +428,8 @@ detect_go_version() detect_rust_version() { info "Detecting agent rust version" - typeset -r yq=$(command -v yq || command -v ${GOPATH}/bin/yq) - if [ -z "$yq" ]; then + typeset -r yq=$(command -v yq || command -v ${GOPATH}/bin/yq || echo "${GOPATH}/bin/yq") + if [ ! -f "$yq" ]; then source "$yq_file" fi @@ -475,8 +475,8 @@ detect_cmake_version() { info "Detecting cmake version" - typeset -r yq=$(command -v yq || command -v ${GOPATH}/bin/yq) - if [ -z "$yq" ]; then + typeset -r yq=$(command -v yq || command -v ${GOPATH}/bin/yq || echo "${GOPATH}/bin/yq") + if [ ! -f "$yq" ]; then source "$yq_file" fi @@ -522,8 +522,8 @@ detect_musl_version() { info "Detecting musl version" - typeset -r yq=$(command -v yq || command -v ${GOPATH}/bin/yq) - if [ -z "$yq" ]; then + typeset -r yq=$(command -v yq || command -v ${GOPATH}/bin/yq || echo "${GOPATH}/bin/yq") + if [ ! -f "$yq" ]; then source "$yq_file" fi