1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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>
This commit is contained in:
Akihiro Suda 2021-04-23 14:47:18 +09:00
parent 369d0dc092
commit e928692c69
No known key found for this signature in database
GPG key ID: 49524C6F9F638F1A

View file

@ -35,7 +35,7 @@ fi
rootlesskit="" rootlesskit=""
for f in docker-rootlesskit rootlesskit; do for f in docker-rootlesskit rootlesskit; do
if which $f > /dev/null 2>&1; then if command -v $f > /dev/null 2>&1; then
rootlesskit=$f rootlesskit=$f
break break
fi fi
@ -53,7 +53,7 @@ fi
net=$DOCKERD_ROOTLESS_ROOTLESSKIT_NET net=$DOCKERD_ROOTLESS_ROOTLESSKIT_NET
mtu=$DOCKERD_ROOTLESS_ROOTLESSKIT_MTU mtu=$DOCKERD_ROOTLESS_ROOTLESSKIT_MTU
if [ -z $net ]; then if [ -z $net ]; then
if which slirp4netns > /dev/null 2>&1; then if command -v slirp4netns > /dev/null 2>&1; then
# If --netns-type is present in --help, slirp4netns is >= v0.4.0. # If --netns-type is present in --help, slirp4netns is >= v0.4.0.
if slirp4netns --help | grep -qw -- --netns-type; then if slirp4netns --help | grep -qw -- --netns-type; then
net=slirp4netns net=slirp4netns
@ -65,7 +65,7 @@ if [ -z $net ]; then
fi fi
fi fi
if [ -z $net ]; then if [ -z $net ]; then
if which vpnkit > /dev/null 2>&1; then if command -v vpnkit > /dev/null 2>&1; then
net=vpnkit net=vpnkit
else else
echo "Either slirp4netns (>= v0.4.0) or vpnkit needs to be installed" echo "Either slirp4netns (>= v0.4.0) or vpnkit needs to be installed"