/usr/sbin/hv_get_dhcp_info is in linux-cloud-tools-common 3.13.0-35.62.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #!/bin/bash
# This example script retrieves the DHCP state of a given interface.
# In the interest of keeping the KVP daemon code free of distro specific
# information; the kvp daemon code invokes this external script to gather
# DHCP setting for the specific interface.
#
# Input: Name of the interface
#
# Output: The script prints the string "Enabled" to stdout to indicate
# that DHCP is enabled on the interface. If DHCP is not enabled,
# the script prints the string "Disabled" to stdout.
#
# Each Distro is expected to implement this script in a distro specific
# fashion.
#set -x
IF_FILE="/etc/network/interfaces"
NMCMD="nmcli"
function checknetworkmanager {
#Assumes if $NMCMD exists, inteface exists and interface is not
# in $IF_FILE then dhcp is being used by NM
if hash $NMCMD >/dev/null 2>&1 ; then
if $NMCMD dev status |grep -q $1 ; then
echo "Enabled"
else
echo "Disabled"
fi
else
#Give up
echo "Disabled"
fi
}
if [ -z $1 ] ; then echo "Disabled"; exit; fi
if [ -e $IF_FILE ]; then
if grep -v -e "^#" $IF_FILE|grep -q $1 ; then
#interface exists so
if grep -q -e $1\.\*dhcp $IF_FILE; then
echo "Enabled"; exit;
else
echo "Disabled"; exit;
fi
else
checknetworkmanager $1
exit
fi
else
checknetworkmanager $1
exit
fi
|