#! /sbin/sh

#    Thomas Lange
#    Institut fuer Informatik
#    Universitaet zu Koeln
#    Pohligstr. 1
#    D-50969 Koeln
#
#    lange@informatik.uni-koeln.de
#
#    Copyright (c) 1997 by Thomas Lange

args=$*

while [ "$*" != "" ]; do
    case "$1" in 
      -d)
          dir=$2; shift;
          ;;
    esac
    name=$1
    shift
done

# if dataless == 1 and
# If base equal usr or opt don't install it
# If type equal usr or kvm don't install it

PKG=0 ; BASE=0
egrep "SUNW_PKGTYPE=(usr|kvm)" $dir/$name/pkginfo >/dev/null && PKG=1
egrep "BASEDIR=/(usr|opt)" $dir/$name/pkginfo >/dev/null && BASE=1

if [ -f /tmp/.dataless ]
then
   if [ $PKG -eq 1 -o $BASE -eq 1 ]
   then
	echo "not installing $name"
	exit 0
   fi
fi

echo "installing $name"
exec /usr/sbin/pkgadd.bin $args
