From 787ff55283067ef3d8da3238e65ca204bc63b3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Piotrowski?= Date: Mon, 6 Jan 2014 13:36:04 +0100 Subject: [PATCH] mkimage-arch: use hash to check if command is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apart from having more predictable return codes on various operating systems, it additionally caches the path to application. Docker-DCO-1.1-Signed-off-by: Bartłomiej Piotrowski (github: Barthalion) --- contrib/mkimage-arch.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/mkimage-arch.sh b/contrib/mkimage-arch.sh index 41070aedb1..da11750c03 100755 --- a/contrib/mkimage-arch.sh +++ b/contrib/mkimage-arch.sh @@ -4,14 +4,12 @@ # requires root set -e -PACSTRAP=$(hash pacstrap &>/dev/null) -[ "$PACSTRAP" ] || { +hash pacstrap &>/dev/null || { echo "Could not find pacstrap. Run pacman -S arch-install-scripts" exit 1 } -EXPECT=$(hash expect &>/dev/null) -[[ "$EXPECT" ]] || { +hash expect &>/dev/null || { echo "Could not find expect. Run pacman -S expect" exit 1 }