Skip to content

Commit

Permalink
ovs-docker: Use a different mechanism to check for commands.
Browse files Browse the repository at this point in the history
Currently, the script uses '--version' option from different commands
to check for their availability. uuidgen on Centos6 has been reported
not to have the '--version' option causing failure in script invocation.

This commit looks for the utilities in $PATH instead. The code is
copied from build-aux/dist-docs.

Reported-by: Michael J. Smalley <[email protected]>
Suggested-by: Ben Pfaff <[email protected]>
Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
shettyg committed Feb 23, 2015
1 parent 4b814d4 commit a835380
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ Maxime Brun [email protected]
Madhu Venugopal [email protected]
Michael A. Collins [email protected]
Michael Hu [email protected]
Michael J. Smalley [email protected]
Michael Mao [email protected]
Michael Shigorin [email protected]
Mihir Gangar [email protected]
Expand Down
21 changes: 14 additions & 7 deletions utilities/ovs-docker
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

check_command_avail () {
while [ $# -ne 0 ]; do
if ("$1" --version) > /dev/null 2>&1; then :; else
echo >&2 "$UTIL: missing $1, cannot proceed"
exit 1
# Check for programs we'll need.
search_path () {
save_IFS=$IFS
IFS=:
for dir in $PATH; do
IFS=$save_IFS
if test -x "$dir/$1"; then
return 0
fi
shift
done
IFS=$save_IFS
echo >&2 "$0: $1 not found in \$PATH, please install and try again"
exit 1
}

ovs_vsctl () {
Expand Down Expand Up @@ -201,7 +206,9 @@ EOF
}

UTIL=$(basename $0)
check_command_avail ovs-vsctl docker uuidgen
search_path ovs-vsctl
search_path docker
search_path uuidgen

if (ip netns) > /dev/null 2>&1; then :; else
echo >&2 "$UTIL: ip utility not found (or it does not support netns),"\
Expand Down

0 comments on commit a835380

Please sign in to comment.