Le 29/12/2010 14:29, Charles Marcus a écrit : > Hello, > > I was wondering if it is possible to 'include' the contents of a file in > the mysql*.cf map files (although I guess if you can with these you can > with others)... > > The reason I ask is, it would be nice when changing auth databases > (which I'm doing now), to just edit one file that contains the db access > information (user, password, hosts, db_name), and have all of the other > maps immediately pick up the change(s). > > Yes, I know I can change the contents of all of the files with a simple > script, but I'm just curious if this can be done. > > Thanks, >
here's a simple Gnu Makefile INCLUDE := mysql.conf SRC := $(wildcard *.mysql) DEST := $(patsubst %.mysql,%.cf, ${SRC}) CHOWN := 700 all: ${DEST} %.cf: ${INCLUDE} %.mysql @cat $^ > $...@.tmp @mv $...@.tmp $@ if you run GNU make, then it will generate foo.cf for each foo.mysql file, by prepending the contents of mysql.conf. Note. I am assuming that the permissions are set on the directory where you place the files (say /etc/postfix/maps/mysql/), so there is no need to chown each file (otherwise, a touch + chown are needed above, before creating the temp file).