On 07/07/2011 02:53 PM, Bruce Dubbs wrote: > > The file I have in mind is /etc/sysconfig/network. I think we can use > variables like > > eth0_onboot=yes > eth0_ip=1.2.3.4 > etc > > Alternatively we could use something like: > > #TYPE:IP:PREFIX:MASK:GATEWAY:BOOT > eth0=static:192.168.1.1:24:192.168.1.255:192.168.1.1:onboot >
If you really want to go to a single config file, why not take a peak at how Ubuntu does their networking scripts then? I don't know how they work internally, but parsing logic seems obvious enough on the surface. The single config file, /etc/network/interfaces, is used there and looks fairly nice and is certainly self explanatory: ========================================= # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1 ========================================= Seem easy enough to parse that...grep for "^auto" and pass field 2 to ifup. Bryan's example works here too, just append the following to the file: ========================================= # Turn on Wake-On-LAN for eth0 iface eth0 ? WOL ========================================= The ifup script greps for all lines containing "^iface $1" (which also has the type and service fields), record the line numbers found, get type and service from those line numbers (f3 and f4 resp.), next line, next line, next line until a ^#, empty line, or EOF is found. Pass the following lines to the service script on a single line and let the service script handle the arguments in a shifting while loop. Same process for ifdown except to take the highest numbered line first. We probably don't even need the type field. Doesn't get to look any "nicer" than that for single config file and our existing modular method for extending the available services can be reused (although they'll require some modifications). We can even tear down the interfaces properly based on a running cache constructed the same way (as was suggested a few weeks ago in the LSB thread). -- DJ Lucas -- This message has been scanned for viruses and dangerous content, and is believed to be clean. -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page