Browse code

dockerd-rootless.sh: use `command -v` instead of `which`

`which` binary is often missing

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit e928692c6903983ad1fb7a3b94f5520810c52f38)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>

Akihiro Suda authored on 2021/04/23 14:47:18
Showing 1 changed files
... ...
@@ -35,7 +35,7 @@ fi
35 35
 
36 36
 rootlesskit=""
37 37
 for f in docker-rootlesskit rootlesskit; do
38
-	if which $f > /dev/null 2>&1; then
38
+	if command -v $f > /dev/null 2>&1; then
39 39
 		rootlesskit=$f
40 40
 		break
41 41
 	fi
... ...
@@ -53,7 +53,7 @@ fi
53 53
 net=$DOCKERD_ROOTLESS_ROOTLESSKIT_NET
54 54
 mtu=$DOCKERD_ROOTLESS_ROOTLESSKIT_MTU
55 55
 if [ -z $net ]; then
56
-	if which slirp4netns > /dev/null 2>&1; then
56
+	if command -v slirp4netns > /dev/null 2>&1; then
57 57
 		# If --netns-type is present in --help, slirp4netns is >= v0.4.0.
58 58
 		if slirp4netns --help | grep -qw -- --netns-type; then
59 59
 			net=slirp4netns
... ...
@@ -65,7 +65,7 @@ if [ -z $net ]; then
65 65
 		fi
66 66
 	fi
67 67
 	if [ -z $net ]; then
68
-		if which vpnkit > /dev/null 2>&1; then
68
+		if command -v vpnkit > /dev/null 2>&1; then
69 69
 			net=vpnkit
70 70
 		else
71 71
 			echo "Either slirp4netns (>= v0.4.0) or vpnkit needs to be installed"