3

I'm building a new version of my own debian package, there is something was changed and some files now should be removed (for example old upstart scripts which shouldn't be executed more). I just removed those files from debian package and looks like they are missing in resulting deb-file. Also if I'm installing new version on a clean machine everything is fine, but when I upgrading extising installation removed files are still there and present in a list of owned by package files: dpkg -L <package name> (or at /var/lib/dpkg/info/<package-name>.list which is obviously the same thing).

So my question is: how should I remove those files correctly?

ppeterka
  • 105
  • 6
simplylizz
  • 133
  • 5
  • Are these all `conffiles`? As far as I know anything that isn't a `conffile`, but I may be wrong. – Zoredache Sep 15 '16 at 19:02
  • As I can see in the docs: `dh_installdeb(1) automatically flags any files under the /etc directory as conffiles`, it's upstart scripts (at least only them are bothering me right now) so they are placed in `/etc/init.d/` and I think yes, they should be marked as conffiles. – simplylizz Sep 15 '16 at 19:11

1 Answers1

4

The answer is that when it comes to conffiles the user of the package is intended to resolve the cleanup of cruft themselves.

I am not sure about the specifics from a Debian packaging Policy perspective, but if you need remove, relocate, or modify a conffile in an upgrade, you can handle it in one of the various preinst/postinst hook scripts. I know I have seen this done to a certain degree existing packages.

Here is an example from the the grub postinst /var/lib/dpkg/info/grub-common.postinst script. The call to dpkg-maintscript-helper rm_conffile will remove the configuration under certain conditions.

#!/bin/sh
set -e
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/grub.d/10_freebsd 2.00-14~ -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/grub.d/10_hurd 2.00-14~ -- "$@"
# End automatically added section
Zoredache
  • 130,897
  • 41
  • 276
  • 420