]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - debian/cloud-tools/hv_get_dhcp_info
3 # This example script retrieves the DHCP state of a given interface.
4 # In the interest of keeping the KVP daemon code free of distro specific
5 # information; the kvp daemon code invokes this external script to gather
6 # DHCP setting for the specific interface.
8 # Input: Name of the interface
10 # Output: The script prints the string "Enabled" to stdout to indicate
11 # that DHCP is enabled on the interface. If DHCP is not enabled,
12 # the script prints the string "Disabled" to stdout.
14 # Each Distro is expected to implement this script in a distro specific
19 IF_FILE
="/etc/network/interfaces"
22 function checknetworkmanager
{
23 #Assumes if $NMCMD exists, inteface exists and interface is not
24 # in $IF_FILE then dhcp is being used by NM
25 if hash $NMCMD >/dev
/null
2>&1 ; then
26 if $NMCMD dev status |
grep -q $1 ; then
37 if [ -z $1 ] ; then echo "Disabled"; exit; fi
39 if [ -e $IF_FILE ]; then
40 if grep -v -e "^#" $IF_FILE|
grep -q $1 ; then
42 if grep -q -e $1\.\
*dhcp
$IF_FILE; then
45 echo "Disabled"; exit;
48 checknetworkmanager
$1
52 checknetworkmanager
$1