Summary: Using the LSB Bootscripts

Jeremy Huntwork jhuntwork at lightcubesolutions.com
Wed May 18 12:46:06 PDT 2011


On 5/15/11 3:25 AM, DJ Lucas wrote:
> wanted anyway). Problem with dhclient is that the value of DHCP_STOP
> will always be empty...all interfaces using dhclient will go. If you do
> 'service network stop' then no big deal. OTOH, if you execute ifdown
> ethn, and you have dhclient configured on multiple interfaces, not so
> good. I still don't understand why anyone would choose dhclient over
> dhcpcd. This will work, I just need a slightly more intelligent way to
> handle it, might actually be easier to provide a default IFCONFIG values
> in each service script, and walk /lib/network-services.

dhclient is the reference implementation and widely used, it works well. 
Also, I believe your statement about stopping per interface is 
incorrect, or at least I may be misunderstanding what you're saying.
You can kill a specific pid file per interface for dhclient. Here's what 
Fedora does:

[ -n "$(pidof -x dhclient)" ] && {
    for VER in "" 6 ; do
         if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
                 dhcpid=$(cat /var/run/dhclient$VER-${DEVICE}.pid)
                 if [[ "$DHCPRELEASE" = [yY1]* ]];  then
                         /sbin/dhclient -r -lf 
/var/lib/dhclient/dhclient$VER-${DEVICE}.leases -pf 
/var/run/dhclient-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1
                         retcode=$?
                 else
                         kill $dhcpid >/dev/null 2>&1
                         retcode=$?
                         reason=STOP$VER interface=${DEVICE} 
/sbin/dhclient-script
                 fi
                 if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
                         rm -f /var/run/dhclient$VER-${DEVICE}.pid
                         kill $dhcpid >/dev/null 2>&1
                 fi
         fi
     done
}

JH



More information about the lfs-dev mailing list