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)
This commit is contained in:
parent
da4ba80733
commit
787ff55283
1 changed files with 2 additions and 4 deletions
|
@ -4,14 +4,12 @@
|
||||||
# requires root
|
# requires root
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
PACSTRAP=$(hash pacstrap &>/dev/null)
|
hash pacstrap &>/dev/null || {
|
||||||
[ "$PACSTRAP" ] || {
|
|
||||||
echo "Could not find pacstrap. Run pacman -S arch-install-scripts"
|
echo "Could not find pacstrap. Run pacman -S arch-install-scripts"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT=$(hash expect &>/dev/null)
|
hash expect &>/dev/null || {
|
||||||
[[ "$EXPECT" ]] || {
|
|
||||||
echo "Could not find expect. Run pacman -S expect"
|
echo "Could not find expect. Run pacman -S expect"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue