On Tue, Jan 31, 2012 at 11:01:35AM -0800, Gurucharan Shetty wrote: > case "$TYPE" in > OVSBridge) > ovs-vsctl -- --may-exist add-br "$DEVICE" $OVS_OPTIONS > ${OVS_EXTRA+-- $OVS_EXTRA} > - ${OTHERSCRIPT} ${CONFIG} ${2} > + if [ "${OVSBOOTPROTO}" = "dhcp" -a -n "${OVSINTF}" ]; then > + INTF=`echo $2 | sed -e 's/ifcfg-//'` > + echo "${OVSDHCPINTERFACES}" | grep -q "$INTF\(\$\| \)" > + if [ $? -eq 0 ]; then
I think that you can replace the above three lines by simply: if expr X"$OVSDHCPINTERFACES" : X".*\b${INTF#ifcfg-}\b" >/dev/null; then or this might be more readable assuming you want commas to separate interfaces in $OVSDHCPINTERFACES: case $OVSDHCPINTERFACES in ${INTF#ifcfg-} | \ "${INTF#ifcfg-},"* | \ *",${INTF#ifcfg-}" | \ *",${INTF#ifcfg-},"*) BOOTPROTO=dhcp ${OTHERSCRIPT} ${CONFIG} ;; esac > + export BOOTPROTO="dhcp" > + ${OTHERSCRIPT} ${CONFIG} I think that BOOTPROTO=dhcp ${OTHERSCRIPT} ${CONFIG} is probably a better way to express it, so that BOOTPROTO does not continue to be set. (Unless you want that?) > + fi > + fi > + if [ "${OVSBOOTPROTO}" != "dhcp" -a -z "${OVSINTF}" ]; then > + ${OTHERSCRIPT} ${CONFIG} > + fi > ;; > OVSPort) > /sbin/ifup "$OVS_BRIDGE" > ${OTHERSCRIPT} ${CONFIG} ${2} > ovs-vsctl -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" > $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA} > + export OVSINTF=${CONFIG} > + /sbin/ifup "$OVS_BRIDGE" > + unset OVSINTF It is easier to write: OVSINTF=$CONFIG /sbin/ifup "$OVS_BRIDGE" rather than the above three lines. Similarly in the second case. Thanks, Ben. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev