Hi!

Thanks Axalon for your quick reaction to my big provocation! (I was sure
that saying Microsoft would give something! =))

Anyway, the new /sbin/ifup would be *even* better if instead of :

if [ -n "$DHCP" ]; then
    echo -n "Determining IP information for $DEVICE via dhcpcd..."
    if /sbin/dhcpcd -i $DEVICE -h $HOSTNAME ; then
        echo " done."
    else
        echo " failed."
        exit 1
    fi

We were doing a test to avoid the message that says that there is already a
"/var/run/dhcpcd-${DEVICE}.pid" file. The problem is that if your computer
crashes, the "/sbin/ifdown ${DEVICE}" is not deleted, and thus on the
reboot, you don't get any IP.

I mean : if your PC crashes, it is like running twice "/sbin/ifup eth0". On
the second time, you don't get any IP.

I think that you could do :

if [ -n "$DHCP" ]; then
    if [ -f /var/run/dhcpcd-${DEVICE}.pid ]; then
        OLD_PID=`cat /var/run/dhcpcd-${DEVICE}.pid`
        kill `ps ax|grep dhcpcd|grep $OLD_PID|cut -b 1-5`
        rm -f /var/run/dhcpcd-${DEVICE}.pid
    fi
    echo -n "Determining IP information for $DEVICE via dhcpcd..."
    if /sbin/dhcpcd -h $HOSTNAME $DEVICE ; then
        echo " done."
    else
        echo " failed."
        exit 1
    fi

Please see also the change in the call of dhcpcd. The "-i" parameter isn't
the same as for "pump". It doesn't describe the name of the interface
(Please see "man dhcpcd").

Thanks for staying cool while I wasn't... Correct the above and I promise
that I'll never bother you with dhcpcd again. =)

Gregus

Reply via email to