comment 0

Merging .pacnew Files

I have a couple Linodes running. My mail server is powered by Arch Linux, and I always forget to check if new configuration updates need to be applied. I’m not a professional IT admin, so when things are working, I tend to leave well enough alone.

A quick way to locate configuration updates that were never applied is:

$ sudo find /etc -name '*.pacnew'

I throw a sudo on there because some folders in /etc are protected from prying eyes. This tells me I have several updates to Postfix I missed:

/etc/postfix/main.cf.pacnew
/etc/postfix/master.cf.pacnew
/etc/postfix/access.pacnew

Once I’ve found a file I want to inspect further, I can use vimdiff to interactively merge them:

$ sudo vimdiff /etc/postfix/main.cf{,pacnew}

This shell expansion will open up vim and compare the original (on the left) and the update (on the right). You can quickly move between differences using ]c (for next) or [c (for previous). To quickly copy the current change over, use do (diff obtain). I prefer to manually type in the updates if I spot any I need.

Now maintain those servers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s