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

Re: How do I detect if a package is installed?



andersee@et.byu.edu (Erik B. Andersen) writes:

> I need to be able to detect if a specific package is installed from within
> a script, in order to properly work around a dpkg bug (#4947).  I have
> written the following script which does NOT work.  Any suggestions on how
> to fix things?  I can not figure it out.

This whole method won't work at all because dpkg locks its database
while running installation and removal scripts.

Here's what you can do:

1. have the new elvis package provide all the files and directories
that the old package did, but make the files of size zero.

2. When installed, dpkg will detect that the old package has been
replaced out of existence, and purge the old package.  See paragraph 3
of the programmer's manual 8.5.1 for details.

3. In the new package's postinst, delete all the fake files.

Believe it or not, util-linux uses this, with Ian's approval, to
replace certain parts of the obsolete misc-utils.


Guy

--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: