Use "type" to take place of "which" and update the output

When run tools/init-runonce without some client installed,it's
retrun not friendly and confuse people,such as user does not
install python-openstackclient, it will return "openstack not
installed".This patch update it.

Use "type" command to avoid "which"

TrivialFix

Change-Id: I53789a767b3a2727bf2cb848c2881272e313e14c
This commit is contained in:
caoyuan 2016-09-13 23:40:01 +08:00
parent 0d28b311eb
commit d48cc50e9e

View File

@ -12,10 +12,14 @@ unset LANGUAGE
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
for i in curl nova neutron openstack; do for i in curl nova neutron openstack; do
if [[ ! $(which $i) ]]; then if [[ ! $(type $i 2>/dev/null) ]]; then
echo "$i not installed. Please install $i before proceeding" if [ "$i" == 'curl' ]; then
exit 1 echo "$i not installed. Please install $i before proceeding"
fi else
echo "python-${i}client not installed. Please install python-${i}client before proceeding"
fi
exit
fi
done done
# Move to top level directory # Move to top level directory
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")