3

A package I'm installing wants to add a config file to a shared /.../config.d/ folder which another program reads on startup. I want to add my own configuration to replace the one installed by apt.

It's easy enough to "divert" the file with dpkg-divert /.../config.d/package-config-file but that just renames the file to /.../config.d/package-config-file.distrib. This happens because of a documented behavior:

When adding, default is --local and --divert <original>.distrib.

This may be sufficient for some programs, but the program I'm using reads all files in /.../config.d/ no matter the extension.

No matter because I can manually specify the --divert option:
dpkg-divert --divert /dev/null /.../config.d/package-config-file

This seems to work fine for one package. However when I want to do this for a second file, dkpg-divert doesn't like having two "diversions" going to the same file (/dev/null).

So, is there a good way to divert packages files you know you don't want to the trash?

I could make a /trash folder and put them all in there, but why keep that around.

Is what I want possible?

1 Answers1

0

Never ever redirect to an important system file. Depending on your version of apt, this may or may not replace /dev/null with an ordinary file (so everything written to /dev/null will actually be written to disk). All redirections should be to regular files.