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

Re: upgrade only if installed



On Wed, Jun 14, 2006 at 04:00:19PM -0400, Kamaraju Kusumanchi wrote:
> I would like to upgrade a package only if it is installed. If the package is 
> not already installed, I would not want it to be installed. Is this possible? 

There's probably a nice prepackaged way to do it, but you
could first look through the output of
'dpkg --get-selections' for any packages with the specified
name that are installed. So for instance, if you want to
upgrade firefox only if it's installed, you could do

dpkg --get-selections |grep -v 'deinstall\|purge' | cut -f1 |grep '^firefox$'

Using '^firefox$' prevents the command from matching
packages with firefox in their name, like
firefox-gnome-support.

That command will return 0 if it finds anything, 1 if it
doesn't. That should get you on your way.

-- 
Stephen R. Laniel
steve@laniels.org
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key

Attachment: signature.asc
Description: Digital signature


Reply to: