129194
#!/bin/bash
129194
129194
# This example script retrieves the DHCP state of a given interface.
129194
# In the interest of keeping the KVP daemon code free of distro specific
129194
# information; the kvp daemon code invokes this external script to gather
129194
# DHCP setting for the specific interface.
129194
#
129194
# Input: Name of the interface
129194
#
129194
# Output: The script prints the string "Enabled" to stdout to indicate
129194
#	that DHCP is enabled on the interface. If DHCP is not enabled,
129194
#	the script prints the string "Disabled" to stdout.
129194
#
129194
# Each Distro is expected to implement this script in a distro specific
129194
# fashion. For instance on Distros that ship with Network Manager enabled,
129194
# this script can be based on the Network Manager APIs for retrieving DHCP
129194
# information.
129194
129194
if_file="/etc/sysconfig/network-scripts/ifcfg-"$1
129194
129194
dhcp=$(grep "dhcp" $if_file 2>/dev/null)
129194
129194
if [ "$dhcp" != "" ];
129194
then
129194
echo "Enabled"
129194
else
129194
echo "Disabled"
129194
fi