Managing config files with Debhelper

cn flag

I have packaged an application for Debian using Debhelper. The application's config file is located under /opt/{package}/releases/default/ instead of /etc/{package}/ and cannot be moved easily. Up until recently all that was required to mark this config file as a conffile was to include it in the packaging file debian/{package}.conffiles. This had the desired effect that apt/dpkg would detect local changes to the config file upon upgrade and handle it in a smart way instead of clobbering the local changes with the packaged version.

After upgrading the package tooling to a newer version I no longer enjoy this benefit. The man page dh_installdeb(1) reads:

  Historically, this file was needed to manually mark files files as 
  conffiles.  However, it has become de facto obsolete since debhelper 
  automatically computed which files should be marked as conffiles.

Further, from the Debian New Maintainers' Guide:

5.3. conffiles
  dh_installdeb(1) automatically flags any files under the /etc directory 
  as conffiles, so if your program only has conffiles there you do not 
  need to specify them in this file. For most package types, the only place 
  conffiles should ever be is under /etc, and so this file doesn't need to exist.

My question is how do I achieve the old behaviour by keeping the config file under /opt/?

mx flag

Debian policy says that config files must be in /etc, and to use symlinks if it is not feasible to modify the package to read from /etc directly:

10.7.2. Location

Any configuration files created or used by your package must reside in /etc. [...]

If your package creates or uses configuration files outside of /etc, and it is not feasible to modify the package to use /etc directly, put the files in /etc and create symbolic links to those files from the location that the package requires.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.