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

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
  • 133,737