Blame SOURCES/hv_get_dhcp_info.sh

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