Everyone has to generate configuration files, and basically they're the same across multiple machines, normally with different IP addresses.
m4(1) is the GNU macro processor. You may recognise it from such tools as autoconf(1) and sendmail(8). Here are some cool things you can do with it.
divert(-1) define(conf_INTIF,`10.7.0.254') define(conf_INTNET,`10.7.0.0') define(conf_INTBCAST,`10.7.0.255') divert(0)dnl
As always with makefiles, you can do lots of magic here. See MakefileHowto for a lot of useful information.
FILES=interfaces all: $(FILES) DESTDIR ?= ./etc
interfaces: interfaces.m4
%:%.m4
m4 < $< > $@
- install
cp -f interfaces $(DESTDIR)/network/
The magic is all in the m4 section: that rule says to build any file % from a %.m4, pipe the .m4 file into the m4 command (confused yet?) and then divert the output into the eventual file.
Basically, what this does is lets you define files like this:
include(`config.m4')dnl
auto lo iface lo inet loopback
- Internal network connection: eth0
auto eth0 iface eth0 inet static
address conf_INTIF netmask conf_INTMASK broadcast conf_INTBCAST
And then the m4 processor will go through the config.m4 file you have included (the dnl means 'do not linefeed'), and generate a file like this:
auto lo iface lo inet loopback
- Internal network connection: eth0
auto eth0 iface eth0 inet static
address 10.7.0.254 netmask 255.255.255.0 broadcast 10.7.0.255
2 pages link to ConfigurationScripts:
lib/main.php:944: Notice: PageInfo: Cannot find action page