2

I maintain a native Debian package which installs an application and an initial SQLite database. I expect the application to edit the database.

How do I prevent upgrades from replacing the database?

I thought conffiles would be the solution, but the Debian's maintainer guide says:

If your program uses configuration files but also rewrites them on its own, it's best not to make them conffiles because dpkg will then prompt users to verify the changes all the time.

What is the best alternative?

2

If you’re really talking about shipping a database, and not the configuration files to access a database, the answer is somewhat in the problem statement: a database isn’t a configuration file.

The best alternative (in my opinion) is to install the database in maintainer scripts, not directly as an installed file in the package. That way your maintainer scripts can deal with the various situations that can arise, including

  • initial installation with no database;
  • upgrade with an existing database which should be preserved as-is;
  • upgrade with an existing database which needs to be migrated.

You’d ship the database in a temporary location in your package, somewhere under /usr/share/yourpackage, and only move it to its real location if necessary. Don’t ship it in /tmp, and don’t attempt to “de-register” the file. See also Where do temporary files go while installing a .deb package?

For extra bonus points, you could look at dbconfig-common.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.