0

I'm maintaining Ubuntu 16.04.6 LTS and Debian 4.9.210-1 systems.

When I apt-get upgrade, I often get the notice that my local configuration files have changes to the updated package configuration files.

That makes sense, because I tweak these configuration files to my needs, e.g. increase memory settings in PHP, make Apache hide version numbers in HTTP responses etc.

Logically, I want to keep my edited configuration files during each apt-get upgrade, but unfortunately, over time my locally changed configuration files diff more and more from the vanilla package versions witch each upgrade, as updated vanilla package configuration file change themselves: The package maintainers fix a typo in a comment, add a comment, change its formatting, add a new option and such.

These ever-increasing diffs make it harder and harder to see the relevant changes in updated configuration files.

To make it easier to read these diffs during the next upcoming upgrades, I'd like to incorporate the non-relevant changes (updated comments etc.) into my locally changed configuration file while keeping my relevant changes intact.

Is there an easy way to "cherry-pick" only those configuration file changes that I'm interested while leaving my local configuration intact?

1
  • To start with, which version of Linux have you installed (Ubuntu server, Ubuntu desktop, Kubuntu, Lubuntu, Xubuntu, Ubuntu MATE, et al.) , and which release number? Different releases have different tools for us to recommend. Please click edit and add that vital information to your question so all the facts we need are in the question. Please don't use Add Comment, since that's our channel to you. All facts about your system should go in the Question with edit
    – K7AAY
    May 12, 2020 at 16:00

2 Answers 2

1

I have not experienced or been made aware of the type of functionality you are looking for. It would be a convenient thing to have though. You might suggest it as a feature request. For now, what I do is back up my important config files prior to upgrading. If there are new features or things in the new version that are not in the old config file I let the upgrade overwrite with provider's version and then manually put the important stuff back in. Painful but I am not aware of another way. ;)

0

To answer your question, there isn't a way to do it with the packager. It's all or nothing.

However, there are things you can do to help long term:

  1. For Apache2, you can create separate configuration files which will overwrite the defaults; on Ubuntu it goes under /etc/apache2/conf-available, then you can enable it with a2enconf. Removing the version is done that way on my server!

  2. Some tools offer a way to create a file in a subdirectory (similar to Apache) and give you a way to sort those files by starting the name with a two digits number. logrotate has the /etc/logrotate.d/... folder. This one does not give you the ability to override and existing file, though.

  3. Have a script that tweaks the parameters you want to tweak, just remember to run it each type you do an update (with apt, you could create a hook, then it runs automatically!) I wrote a tool, but I think there are better ones out there, to do such. My tool reads the existing file, adds/removes parameters, then save that back. For example, for postsrs, I want to change the SRS_DOMAIN variable, so I do:

     edit-config /etc/default/postsrsd SRS_DOMAIN example.com
    

    The file has no such name by default (and nothing works until you add a name and restart that service), before:

     SRS_DOMAIN=
    

    After running my command:

     SRS_DOMAIN=example.com
    

    I try to use my command only against configuration files that cannot otherwise have an include or subdirectory.

    Note: edit-config is part of my advgetopt project. I have a PPA which includes it, but the PPA changes and is not always 100% functional... use at your own risk!

     $ sudo add-apt-repository ppa:snapcpp/ppa
     $ sudo apt-get install advgetopt
     $ edit-config --help
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .