From f9dcc238a481b9a72d85c0b7effe8d2f8f4110ef Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 02:23:20 +0200 Subject: [PATCH] setup.sh: require `yq` only when -f option is specified --- setup.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/setup.sh b/setup.sh index 6f73ea67..4df47bc4 100755 --- a/setup.sh +++ b/setup.sh @@ -9,11 +9,6 @@ if ! check_command jq; then exit 1 fi -if ! check_command yq; then - echo "yq not found. Install it from https://mikefarah.gitbook.io/yq" - exit 1 -fi - OS_NAME=$(echo "$RUNNER_OS" | awk '{print tolower($0)}') ARCH_NAME=$(echo "$RUNNER_ARCH" | awk '{print tolower($0)}') MANIFEST_BASE_URL="https://storage.googleapis.com/flutter_infra_release/releases" @@ -93,15 +88,19 @@ while getopts 'tc:k:d:l:pa:n:f:' flag; do t) TEST_MODE=true ;; a) ARCH="$(echo "$OPTARG" | awk '{print tolower($0)}')" ;; n) VERSION="$OPTARG" ;; - f) VERSION_FILE="$OPTARG" ;; + f) + if ! check_command yq; then + echo "yq not found. Install it from https://mikefarah.gitbook.io/yq" + exit 1 + fi + VERSION_FILE="$OPTARG" + ;; ?) exit 2 ;; esac done [ -z "$ARCH" ] && ARCH="$ARCH_NAME" - - if [ -n "$VERSION_FILE" ]; then if [ -n "$VERSION" ]; then echo "Cannot specify both a version and a version file"