From 60ec93f7c2a44cb0dcedc7eb5a82a8d40798b54e Mon Sep 17 00:00:00 2001 From: Mark Jeromin Date: Wed, 31 Oct 2018 21:43:29 -0400 Subject: [PATCH] Fix error handling when go command is missing Signed-off-by: Mark Jeromin --- contrib/download-frozen-image-v2.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/download-frozen-image-v2.sh b/contrib/download-frozen-image-v2.sh index 54b592307f..38d94d32d9 100755 --- a/contrib/download-frozen-image-v2.sh +++ b/contrib/download-frozen-image-v2.sh @@ -6,14 +6,14 @@ set -eo pipefail # debian latest f6fab3b798be 10 weeks ago 85.1 MB # debian latest f6fab3b798be3174f45aa1eb731f8182705555f89c9026d8c1ef230cbf8301dd 10 weeks ago 85.1 MB -if ! command -v curl &> /dev/null; then - echo >&2 'error: "curl" not found!' - exit 1 -fi -if ! command -v jq &> /dev/null; then - echo >&2 'error: "jq" not found!' - exit 1 -fi + +# check if essential commands are in our PATH +for cmd in curl jq go; do + if ! command -v $cmd &> /dev/null; then + echo >&2 "error: \"$cmd\" not found!" + exit 1 + fi +done usage() { echo "usage: $0 dir image[:tag][@digest] ..."