(test -x /usr/sbin/ovs-vswitchd && test -x /usr/sbin/ovsdb-server) || exit 0
+_SYSTEMCTL_SKIP_REDIRECT=yes
+
. /usr/share/openvswitch/scripts/ovs-lib
test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
network_interfaces () {
INTERFACES="/etc/network/interfaces"
[ -e "${INTERFACES}" ] || return
- bridges=`awk '{ if ($1 == "allow-ovs") { print $2; } }' "${INTERFACES}"`
+ bridges=`ifquery --allow ovs --list`
[ -n "${bridges}" ] && $1 --allow=ovs ${bridges}
}
fi
set "$@" $OVS_CTL_OPTS
"$@" || exit $?
- [ "$2" = "start" ] && network_interfaces ifup
+ if [ "$2" = "start" ] && [ "$READ_INTERFACES" != "no" ]; then
+ network_interfaces ifup
+ fi
}
stop () {
- network_interfaces ifdown
+ [ "$READ_INTERFACES" != "no" ] && network_interfaces ifdown
ovs_ctl stop
}
depmod -a
if [ -e /sys/module/openvswitch ]; then
- LOADED_SRCVERSION=`cat /sys/module/openvswitch/srcversion`
- LOADED_VERSION=`cat /sys/module/openvswitch/version`
+ LOADED_SRCVERSION=`cat /sys/module/openvswitch/srcversion \
+ 2>/dev/null`
+ LOADED_VERSION=`cat /sys/module/openvswitch/version \
+ 2>/dev/null`
elif [ -e /sys/module/openvswitch_mod ]; then
- LOADED_SRCVERSION=`cat /sys/module/openvswitch_mod/srcversion`
- LOADED_VERSION=`cat /sys/module/openvswitch_mod/version`
+ LOADED_SRCVERSION=`cat /sys/module/openvswitch_mod/srcversion \
+ 2>/dev/null`
+ LOADED_VERSION=`cat /sys/module/openvswitch_mod/version \
+ 2>/dev/null`
fi
SRCVERSION=`modinfo -F srcversion openvswitch 2>/dev/null`
VERSION=`modinfo -F version openvswitch 2>/dev/null`
start restart
fi
else
- stop
- start
+ READ_INTERFACES="no" stop
+ READ_INTERFACES="no" start
fi
}