Update "which" command to "type"

Validate a program exist,we should avoid "which"
Refer to http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script/677212#677212

TrivialFix

Change-Id: I3d614aef2ac6598a51d830b02795ef186d4fc531
This commit is contained in:
caoyuan 2016-09-15 08:27:10 +08:00
parent 32b74538d8
commit 1b8c4ff779

View File

@ -24,13 +24,13 @@ REGISTRY=${REGISTRY_URL}:${REGISTRY_PORT}
ADMIN_PROTOCOL="http" ADMIN_PROTOCOL="http"
function _ensure_lsb_release { function _ensure_lsb_release {
if [[ -x $(which lsb_release 2>/dev/null) ]]; then if [[ -x $(type lsb_release 2>/dev/null) ]]; then
return return
fi fi
if [[ -x $(which apt-get 2>/dev/null) ]]; then if [[ -x $(type apt-get 2>/dev/null) ]]; then
apt-get -y install lsb-release apt-get -y install lsb-release
elif [[ -x $(which yum 2>/dev/null) ]]; then elif [[ -x $(type yum 2>/dev/null) ]]; then
yum -y install redhat-lsb-core yum -y install redhat-lsb-core
fi fi
} }