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

Re: Problem with --purge and reinstalling



On Wed, Sep 05, 2007 at 09:58:32PM +0200, Thibaut Paumard wrote:
> Dear mentors,
>
> I'm maintaining the yorick-* packages. The source package is split into 
> yorick, yorick-data and yorick-dev. The conffiles are in the -data package. 
> However, yorick.postrm removes these files upon --purge. I guess I must 
> have been slightly offset from my head when I did this, but that's the 
> situation in Etch.
conffiles shouldn't ever be modified, created, moved, or removed by
any package except dpkg.

> I just noticed a problem if a user does:
> aptitude install yorick (installs yorick and yorick-data)
> aptitude remove yorick (removes yorick and yorick-data)
> dpkg --purge yorick (deletes /etc/yorick/*, which actually belongs to 
> yorick-data)
> aptitude install yorick (installs yorick and yorick-data)
>
> When reinstalling yorick the conffiles are not installed! One needs to 
> purge y-data for these conffiles to get reinstalled.
They're probably in etch's dpkg's "obsolete" state; use dpkg -s on
those pacakges.

> I can clearly see that there is a bug in my packages in that yorick.postrm 
> should certainly not remove files owned by yorick-data, but I don't 
> understand why the files are not reinstalled.
That's the (obsolete) thing.  Removal of conffiles is supposed to be
preserved.

> I also wonder how to fix this issue best: I guess /etc/yorick files should 
> belong in the package "yorick", not "yorick-data", but can I simply switch 
> the files from one package to the other?
No.  You have to remove the files in preinst if their md5sum matches
the md5sum in dpkg's status database.  Actually it's more complicated
if you support dpkg rollbacks.  You have to rename them in preinst (if
they're unmodified), remove them in postinst (in the normal scenario
when everything works), but rename them back to their original name in
postrm abort-upgrade.  All conditional on their existence, version
checks, and md5sum checks. [0]

Technically that might not be necessary if the files to be moved are
identical between etch and lenny.

Justin

References

[0] http://justinpryzby.com/debian/dpkg/



Reply to: