diff options
Diffstat (limited to '')
-rwxr-xr-x | pxeserver.tpl | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pxeserver.tpl b/pxeserver.tpl index 3a9c206..1bde266 100755 --- a/pxeserver.tpl +++ b/pxeserver.tpl @@ -168,7 +168,7 @@ int_to_ip() { echo $(($1>>24)).$(($1>>16&0xff)).$(($1>>8&0xff)).$(($1&0xff)) } -# Find the location of the dhcpcd PID file: +# Find out whether the interface is managed by DHCP: get_dhcpcd_pid() { # Find the location of the PID file of dhcpcd: MYDEV="$1" @@ -185,6 +185,17 @@ get_dhcpcd_pid() { fi } +# Find out whether the interface is managed by DHCP: +get_nm_internal_lease() { + # Find the lease of NetworkManager internal dhcp client: + MYDEV="$1" + if [ -s /var/lib/NetworkManager/intern*-${MYDEV}.lease ]; then + echo "$(ls --indicator-style=none /var/lib/NetworkManager/intern*-${MYDEV}.lease)" + else + echo UNKNOWNLOC + fi +} + # The network interface IP configuration routine. # Will be called if the interface was not configured by DHCP. # It ends with a configured network interface: @@ -392,10 +403,12 @@ Alternate keys may also be used: '+', '-', and TAB." 13 72 9 \ # We now know what network interface to use. # - # If dhcpcd is running, it likely has a lease from a LAN DHCP server, - # so we should not activate another DHCP server ourselves now: + # If our interface is configured by DHCP, it likely has a lease from a + # LAN DHCP server, so we should not activate another DHCP server ourself now: if [ -s $(get_dhcpcd_pid ${INTERFACE}) -a -n "$(ps -q $(cat $(get_dhcpcd_pid ${INTERFACE})) -o comm=)" ]; then OWNDHCP="no" + elif [ -s $(get_nm_internal_lease ${INTERFACE}) ]; then + OWNDHCP="no" else # Assume nothing... we will ask the user for confirmation later! OWNDHCP="yes" |