On Wed, 09 May 2012 18:42:46 +0100, mark@quarella.co.uk said:
what would the input to patch look like? (A pointer to relevant resources would be fine!)
Create a "template" file, eg:
AuthUser=someuser AuthPass=somepass mailhub=somehost:587
Create one "real" file, eg:
AuthUser=johnlennon AuthPass=pennylane mailhub=apple:587
Create the patch file:
$ diff -U3 template real > mypatchfile
The patch file looks like this:
--- template 2012-05-10 07:19:44.000000000 +0100 +++ real 2012-05-10 07:19:57.000000000 +0100 @@ -1,4 +1,4 @@ - AuthUser=someuser - AuthPass=somepass - mailhub=somehost:587 + AuthUser=johnlennon + AuthPass=pennylane + mailhub=apple:587
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.