I'm using ssmtp to provide simple mail services on a Linux box.
I want the configuration to be as simple as possible to migrate between
different boxes, but using different users and passwords for different boxes.
So for example I might decide to use the device's MAC address as the username,
and derive a password from that somehow. That way, I can install a filesystem
image onto a device and it will self-configure. (It may be that the device
will call a web service with it's MAC address and retreive settings that way,
but once the script knows what the user and password details are I still need
a method to "insert" them into the configuration files.)
So, my question is how best to "insert" these details into a config file (in
this case /etc/ssmtp/ssmtp.conf but I'm looking for a general solution).
One option would be to simply recreate these files on startup inserting
relevant details - or, better, to use sed (or maybe awk) to replace the
relevant parts of the config. Is that the "right" way to do it? Obviously I'd
need to restart any relevant services after this is done (or better, make sure
it happens before they start).
Is there a general way to insert an environment variable or other value into a
configuration file?
Mark
--
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450
Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER