Hi,  let me follow up on my word.

Here is example of shell script which checks dependency almost like the
perl one in the package. (Not much testing yet but seems to work OK here.)

If you include this, you can remove dependency to PERL.

Osamu
#!/bin/bash

DEBUG=0
# dependency can not have space
LIST="dpkg,pbuilder,bogus|ifupdown,aptitude,bogus2|bosudbogus,boguss"

decho() {
    if [ $DEBUG -eq 1 ] ; then
        echo "$1"
    fi
}

dependency () {
l=""
# split with ,
IFS=","
for i in `echo "$1"`; do 
  INSTALLED=0
  unset IFS
# split with |
  IFS="|"
  for j in `echo "$i"`; do 
    unset IFS
    decho "checking status of \"$j\" package"
    if dpkg -s $j 2>/dev/null | grep -q -e "Status: install ok installed" ; then
      decho ". \"$j\" package is installed."
      INSTALLED=1
    else
      decho "- \"$j\" package is NOT installed."
    fi
  done
  if [ $INSTALLED -eq 0 ]; then 
    if [ -z "$l" ]; then
      l=$i
    else
      l="$l,$i"
    fi
  fi
done
echo "$l"
}

dependency "$LIST"

Reply via email to