Blame hv_get_dhcp_info.sh

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