浏览代码

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 11 年之前
父节点
当前提交
787ff55283
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      contrib/mkimage-arch.sh

+ 2 - 4
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
 }