Browse code

mkimage-arch: use hash to check if command is available

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 <b@bpiotrowski.pl> (github: Barthalion)

Bartłomiej Piotrowski authored on 2014/01/06 21:36:04
Showing 1 changed files
... ...
@@ -4,14 +4,12 @@
4 4
 # requires root
5 5
 set -e
6 6
 
7
-PACSTRAP=$(hash pacstrap &>/dev/null)
8
-[ "$PACSTRAP" ] || {
7
+hash pacstrap &>/dev/null || {
9 8
     echo "Could not find pacstrap. Run pacman -S arch-install-scripts"
10 9
     exit 1
11 10
 }
12 11
 
13
-EXPECT=$(hash expect &>/dev/null)
14
-[[ "$EXPECT" ]] || {
12
+hash expect &>/dev/null || {
15 13
     echo "Could not find expect. Run pacman -S expect"
16 14
     exit 1
17 15
 }