diff options
Diffstat (limited to 'scripts/common.sh')
-rw-r--r-- | scripts/common.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/common.sh b/scripts/common.sh index af7c354..917962e 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -157,3 +157,18 @@ docker_images_require() { cd "$oldpwd" return $ret } + +# Abort the script if required programs are missing +# $1...$n: program name +osmo_cmd_require() { + local fail=0 + for i in "$@"; do + if ! command -v "$i" >/dev/null 2>&1; then + echo "Required program not found: $i" + fail=1 + fi + done + if [ "$fail" = 1 ]; then + exit 1 + fi +} |