How do I detect if a package is installed?
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.
# preinst file for elvis-2.0
if [ `dpkg -l elviscmn >& /dev/null` ] ; then
echo You have an old version of elvis installed. The old version must be
echo removed before the new version can be installed. This will remove
echo your old configuration files as well...
echo -n "Are you sure you wish to proceed? [Y/n] "
if [ $ans != "Y" ] ; then
dpkg --purge elviscmn
echo proceeding with script...
Erik B. Andersen Web: http://www.et.byu.edu/~andersee/
2485 South State St. email: firstname.lastname@example.org or email@example.com
Springville, Ut 84663 phone: (801) 489-1231
--This message was written using 73% post-consumer electrons--
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