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

Re: How to test the presence of packages ?



If you need a simple script logic, you could use bash like this:

==============>8==================>8==============
#!/bin/bash

PACKAGES="package1 package2 package3"

for PACKAGE in ${PACKAGES}; do

        dpkg -l ${PACKAGE} > /dev/null 2>&1

        if [ !$? ]; then
                aptitude install ${PACKAGE}
        fi
done
==============>8==================>8==============

Now, if you need this at package level, you should listen to Pietro's
advices.


On 03/01/12 13:08, fred0a@free.fr wrote:
> Hello,
> 
> What's the way to take, to test the presence of a list of packages and to install one package or more in case where none are already installed ?
> 
> Regards,
> 
> Fred.
> 
> 

-- 
Luis Alejandro Martínez Faneyth
Blog: http://www.huntingbears.com.ve/
Twitter/Identi.ca: @LuisAlejandro
ED51 8FE7 4107 715D 0464  8366 F614 5A95 E78D AA2E


CODE IS POETRY

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: