X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=utilities%2Fovs-save;h=73895f3375ec71f1418588a35b69a19206d7336a;hb=3ba9c6a5a5468626dcfeb1f9a750bb0efc8c6a7a;hp=16ac87982434f1f86adcaef6a63b663c52210bce;hpb=1eccfa36c1ab36e2120a527ca95ca7ef4bce39fc;p=sliver-openvswitch.git diff --git a/utilities/ovs-save b/utilities/ovs-save index 16ac87982..73895f337 100755 --- a/utilities/ovs-save +++ b/utilities/ovs-save @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (c) 2011 Nicira, Inc. +# Copyright (c) 2011, 2013 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,23 +33,8 @@ This script is meant as a helper for the Open vSwitch init script commands. EOF } -PATH=/sbin:/bin:/usr/sbin:/usr/bin - -missing_program () { - save_IFS=$IFS - IFS=: - for dir in $PATH; do - IFS=$save_IFS - if test -x $dir/$1; then - return 1 - fi - done - IFS=$save_IFS - return 0 -} - save_interfaces () { - if missing_program ip; then + if (ip -V) > /dev/null 2>&1; then :; else echo "$0: ip not found in $PATH" >&2 exit 1 fi @@ -152,18 +137,18 @@ save_interfaces () { echo done - if missing_program iptables-save; then - echo "# iptables-save not found in $PATH, not saving iptables state" - else + if (iptables-save) > /dev/null 2>&1; then echo "# global" echo "iptables-restore <<'EOF'" iptables-save echo "EOF" + else + echo "# iptables-save not found in $PATH, not saving iptables state" fi } save_flows () { - if missing_program ovs-ofctl; then + if (ovs-ofctl --version) > /dev/null 2>&1; then :; else echo "$0: ovs-ofctl not found in $PATH" >&2 exit 1 fi @@ -177,12 +162,12 @@ save_flows () { } ovs_vsctl () { - ovs-vsctl --no-wait --timeout=1 "$@" + ovs-vsctl --no-wait "$@" } save_ofports () { - if missing_program ovs-vsctl; then + if (ovs-vsctl --version) > /dev/null 2>&1; then :; else echo "$0: ovs-vsctl not found in $PATH" >&2 exit 1 fi @@ -191,7 +176,7 @@ save_ofports () count=0 for iface in `ovs_vsctl list-ifaces ${bridge}`; do ofport=`ovs_vsctl get interface ${iface} ofport` - [ "${count}" -eq 0 ] && cmd="ovs-vsctl --no-wait --timeout=1" + [ "${count}" -eq 0 ] && cmd="ovs-vsctl --no-wait" cmd="${cmd} -- --if-exists set interface "${iface}" \ ofport_request="${ofport}""