[PATCH] Allow extra configuration from stdin

Roy Marples uberlord at gentoo.org
Wed Feb 22 12:02:51 UTC 2006


Hello list!
Background: I maintain the network setup scripts for Gentoo Linux.

It always struck me as rather strange in that the most configurable dhcp 
client was the most limited in setup from the command line. Especially when 
the dhclient.conf file always took precedence to comand line parameters like 
specifying the script file. The way that I see it is that command line should 
take precedence over config file. Also, there was no command line option to 
specify a hostname to send.

Now, this could be achieved by getting the network scripts to edit 
dhclient.conf to our liking before calling dhclient, but that's not too 
desirable. So a second config file is required. As I dislike using temporary 
files for this I decided to allow stdin to use used, hence the call is like 
so

echo -e "interface eth0 { script \"/path/to/script\"; send host-name 
\"$hostname\"; }" | dhclient eth0

Which works very well for my needs.
Obviously this is of no use to end users, but maybe of use for distributions 
to use in their scripts.

Patches attached for dhcp-3.0.3 and dhcp-3.0.4b2.

Thanks

-- 
Roy Marples <uberlord at gentoo.org>
Gentoo Linux Developer




More information about the dhcp-hackers mailing list