On Wed, 08 Feb 2012, Michael Biebl wrote: > As mentioned, a simple Replaces in the newly split-off package is > not sufficient, as you will have obsolete conffiles, in case the new > split-off package is not installed. > I've seen this problem a couple of times and I thought it would be > worthwile getting a best practice for this case documented.
Thinking a bit more about it could be handled with a conditional dpkg-maintscript-helper rm_conffile that verifies who owns the file currently. preinst: if out=$(dpkg-query --search $CONF 2>/dev/null); then pkg=$(echo "$out" | sed -s 's/: .*//') if [ "$pkg" = "sysvinit-utils" ]; then dpkg-maintscript-helper rm_conffile $CONF <version> sysvinit-utils -- "$@" fi fi and you're doing the same in postinst and postrm except that in postinst you extend it to deal with the case where the command was initiated but not completed (this is a layer violation and thus this whole logic should be integrated in dpkg-maintscript-helper itself). postinst: if out=$(dpkg-query --search $CONF 2>/dev/null); then pkg=$(echo "$out" | sed -s 's/: .*//') if [ "$pkg" = "sysvinit-utils" ]; then dpkg-maintscript-helper rm_conffile $CONF <version> sysvinit-utils -- "$@" else if [ -e $CONF.dpkg-remove ]; then rm $CONF.dpkg-remove fi if [ -e $CONF.dpkg-backup ]; then # XXX: we could also want to replace $CONF to reinstate the # modified conffile mv $CONF.dpkg-backup $CONF.dpkg-bak fi fi fi This needs some tests of course and should ideally be integrated in dpkg-maintscript-helper as a separate command (rm_conffile_if_owner). There are also some edge cases that require some attention (like the fact that the output of dpkg-query --search on diverted file takes several lines). Cheers, -- Raphaël Hertzog ◈ Debian Developer Pre-order a copy of the Debian Administrator's Handbook and help liberate it: http://debian-handbook.info/liberation/ -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120209095814.ga3...@rivendell.home.ouaza.com