[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: May packages rm -rf subdirectories of /etc/ ?



Stephen Zander <gibreel@debian.org> wrote:
>>>>>> "Herbert" == Herbert Xu <herbert@gondor.apana.org.au> writes:
>> Unfortunately dpkg does not handle the case where a
>> conffile ceases to exist in a later version of a package.
>> The conffile will be left on the system even after
>> purging.

> That's why packages have maintainers and postrm scripts.

It really sucks to handle this if you want/need to get rid of it (if
it is unmodified) not only on purge but on upgrades. - You'll need

if [ "$1" =  "configure" ] && \
        dpkg --compare-versions "$2" le-nl "1.2.3" && \
        [ -e /etc/foo ] && \
        [ `md5sum /etc/foo | cut -d\  -f1` = "6bea09fbb18e4676012105fa5fc726c6" ]
then
        echo "Removing orphaned unmodified configfile /etc/foo" 1>&2
        rm /etc/foo
fi

And not only one of these, but one for every version of /etc/foo you
ever shipped (you want to provide smooth upgrades from 1.2.3, 4.5.6
_and_ 4.5.7.

dpkg OTOH does know the md5sum of the last (un)installed version and
does not need a hard-coded lists in postinst.
            cu andreas



Reply to: