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

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.

#!/bin/sh
#
# 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
   echo -n "Are you sure you wish to proceed? [Y/n] "

   read ans
   if [ $ans != "Y" ] ; then
	   exit 1
   fi
   dpkg --purge elviscmn
fi
echo proceeding with script...


 -Erik

--
Erik B. Andersen        Web:    http://www.et.byu.edu/~andersee/ 
2485 South State St.    email:  andersee@et.byu.edu or andersee@debian.org
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


Reply to: