ifquery doesn't exist on Fedora

Updates dhcp-all-interfaces so that we avoid using
ifquery on Fedora to determine if an interface exists.

Adds a new config_exists function which simply looks for
the ifcfg config file on distro's that use netscripts.

Change-Id: Ie55524b83820fe4fab28cc9d3f7e08ca2e42c182
This commit is contained in:
Dan Prince 2014-02-07 13:33:35 -05:00
parent 5964fec479
commit 01e25c378b

View File

@ -50,11 +50,24 @@ function disable_interface() {
fi
}
function config_exists() {
local interface=$1
if [ "$CONF_TYPE" == "netscripts" ]; then
if [ -f "/etc/sysconfig/network-scripts/ifcfg-$interface" ]; then
return 0
else
return 1
fi
else
return ifquery $interface >/dev/null 2>&1
fi
}
for interface in $(ls /sys/class/net | grep -v ^lo$) ; do
MAC_ADDR_TYPE="$(cat /sys/class/net/${interface}/addr_assign_type)"
echo -n "Inspecting interface: $interface..."
if ifquery $interface >/dev/null 2>&1 ; then
if config_exists $interface; then
echo "Has config, skipping."
elif [ "$MAC_ADDR_TYPE" != "0" ]; then
echo "Device has generated MAC, skipping."