Creating and applying a patch to a fileWhat's a patch?
Say you've got a file, let's use the
/etc/exim.conf as an example, and you need to make changes to that file many times over.
This may be the case if you have many servers, and you want all of them to have the same changes made.
The best way to make the same changes to the exim.conf, but to also allow the default exim.conf to have differences in other areas, is to use a patch.
Creating a patch1) To create a patch, first copy your original:
cd /etc
cp exim.conf exim.conf.orig2) Now manually make all the changes you want to your exim.conf:
nano exim.conf3) Create the patch:
diff -u exim.conf.orig exim.conf > exim.conf.patchYou've now got a patch file which can be applied to the original exim.conf for other systems, or if you re-install, etc..
Save it to a location on your website so it can be downloaded to other servers.
Applying your patchYou've got a patch file, and your default exim.conf, and your want your changes to be applied.
4) Save the patch beside the file:
cd /etc/
wget http://your.server.com/exim.conf.patch5) Apply the patch:
patch -p0 < exim.conf.patchAnd you're done, Your patched exim.conf should now have all of the changes that were manually done to the original.
!!