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

Re: How to test the presence of packages ?



Am Dienstag, den 03.01.2012, 14:29 -0430 schrieb Luis Alejandro Martínez
Faneyth:
> 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.
> 

.. of course you would never use such a snipped from a package install
script. The only way is to use dependencies.


Reply to: