On 10/05/12 07:22, Keith Edmunds wrote:
Create a "template" file, eg:
AuthUser=someuser AuthPass=somepass mailhub=somehost:587
[...]
OK, thanks for that, it's option to look at.
Is there a reason why patch would be preferable to sed for something like this?
No, but there are many reasons why Puppet (or similar) would be preferable. To create each patch file (or sed script), you need to craft, by hand, the "real" version of the file above. If you're going to do that, you may as well just copy it to the destination anyway.
I can see that with diff, but I don't really see it with sed; all I'm telling it to do is take the distro-provided file, and make certain changes to it, leaving everything else the same. Generally speaking I would trust the distro to get the defaults right so if the distro has a newer version I'd want to use that but apply my changes to it.
Is there a general tool for config file manipulation? Something that you just tell to set "AuthUser=myuser" and it would locate the relevant line and edit it, or insert it if not present. Something like sed or awk will do this but not in a simple way, such as: sometool myconfig.conf AuthUser=myuser
Since everything in Linux uses text-based config files I'd have thought there was a standard way to edit them from the command line (something like Postfix's postconf but generalised).