On Thursday 28 September 2006 17:48, David Härdeman wrote: > So, instead of checking all the libs for the programs (cryptsetup, > dmsetup) that were downloaded....how about something like this: > > cryptsetup > /dev/null 2>&1 > if [ $? -gt 1 ]; then > # error > fi > > Is this a daft idea? :)
Well, with -gt 1 you check for general errors, not only for existence of
libs. Also, as we normally run scripts in the installer with 'set -e',
(partman being the big exception), I'd suggest something like:
ERR=0
cryptsetup > /dev/null 2>&1 || ERR=$?
case $ERR in
0) : ;;
127)
# error missing deps ;;
*)
# unexpected error ;;
esac
However, creating that construct for all program calls would get rather
ugly (and possibly expensive).
For libraries, checking if the udeb is listed as "installed" in the
/var/lib/dpkg/status file could be an other option. Not sure if there is
an easy way to do that...
pgpSDTcrh0ajB.pgp
Description: PGP signature

