dhcpcd and /etc/hosts

DJ Lucas dj at lucasit.com
Mon May 19 00:04:27 PDT 2003

DJ Lucas wrote:
> It wouldn't be that difficult to add 3 commands 
 > <snip stupid idea I had before>
 > to ifup-eth0 to fix the file, I just need to know where it's
 > important that the IP be correct for any blfs bootscripts, and to
 > be certain that this does no harm.
> Thanks,
> DJ

I just love repling to my own posts it seems :-)

ifup-eth0 creation should be:

cat > /etc/sysconfig/network-devices/ifup-eth0 << "EOF"

source /etc/sysconfig/rc || exit
source $rc_functions || exit
source $network_devices/ifconfig.eth0 || exit

echo "Bringing up the eth0 interface..."
modprobe eth0

echo "Setting up the /etc/hosts file..."
source /var/lib/dhcpc/dhcpcd-eth0.info
sed "s/$IPADDR/" \
      /etc/sysconfig/network-devices/hosts.dhcp > /etc/hosts


Then, have them copy their existing /etc/hosts file to 
edit the new file so the IP address of the fqdn entry is
set to, or anything harmless but zeros for the above

This is completely untested, but should work if it's actually
necessary.  It won't be untested in a few minutes, but I'm going to bed 
after a reboot to check it.  If I see anything out of the ordinary, I'll 
post back.  IMO this should be done just for the sake of being
done correctly, as long as it breaks nothing.  A backup of the
original hosts might be of interest to the book as well.



Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-dev' in the subject header of the message

More information about the blfs-dev mailing list