netbase 5.0 drops /etc/init.d/networking; thank you for that. However, dpkg does not automatically remove conffiles (even unmodified conffiles) when upgrading to a version of the package that does not include the conffile. Thus, upgrading from previous versions of netbase to netbase 5.0 leaves /etc/init.d/networking around. Normally, I'd suggest using dpkg-maintscript-helper rm_conffile, but I don't know if that'll work correctly when the user has already upgraded ifupdown. I don't think a standard procedure exists for moving conffiles between packages; sysvinit and the newly split-out bootlogd have the same problem with bootlogd's init scripts. (Also, I don't quite see how it works to upgrade ifupdown without upgrading netbase, since ifupdown and older netbase both ship /etc/init.d/networking and no conflicts or replaces exists between those versions.) - Josh Triplett
reassign 672945 dpkg severity 672945 wishlist retitle 672945 dpkg should support moving a conffile between packages thanks This is true, as long as you do not have ifupdown installed (which is very unusual). The consensus on #debian-devel is that nobody should waste their time to fix this, but I will be happy to accept a patch. This post documents a possible solution: https://lists.debian.org/debian-devel/2012/02/msg00254.html . As suggested by #debian-devel, I am reassigning this bug to dpkg.
Granted.
Going by that post, would something like the following in the configure
section of the postinst work?
if dpkg --compare-versions "$2" lt 5.1 ; then
if [ "$(dpkg-query --showformat='${Status}' -W ifupdown)" = "unknown ok not-installed" ] &&
[ -e /etc/init.d/networking ] &&
[ "$(md5sum < /etc/init.d/networking)" = "3bb6d34b6a295bb01142d9a667de4b0d -" ] ; then
rm -f /etc/init.d/networking
fi
fi
The version comparison assumes the change goes into version 5.1 of
netbase.
Personally, I'd love to see this bug fixed in dpkg by just removing
unmodified conffiles that disappear from a package, but nonetheless
having a well-supported mechanism to move conffiles between packages
would help.
- Josh Triplett
Not quite, this would be too much easy. At least, we need to check in preinst for the *actual* md5sum of the version of /etc/init.d/networking installed by the old package, set a flag file (maybe containing this md5sum) and then delete the file in postinst if needed.
If you mean to handle upgrades from versions of netbase that shipped a different version of /etc/init.d/networking, note that /etc/init.d/networking has not changed since squeeze, so the squeeze netbase would have exactly the same md5sum; I checked. :) And since Debian doesn't support upgrades that skip a release, an unmodified version of /etc/init.d/networking can only have the one md5sum that I listed. So, the code I provided will work for any supported upgrade scenario. (I agree that the general case for arbitrary packages requires the approach you suggest, but in this particular case the simpler version with a single hardcoded md5sum will work just fine.) - Josh Triplett