#!/bin/sh

# wrapper for installpkg to make meta-pkg like system.
# if directory name is given, cd to the directory and install everything

opt=''
pkgs=''
while [ $# -gt 0 ]
do
  case $1 in
    -root)  # -root /mnt
       opts="`echo $opts $1 $2`"
       shift ; shift
     ;;
    -priority) 
       opts="`echo $opts $1 $2`"
       shift ; shift
     ;;
    -tagfile)
	opts="`echo $opts $1 $2`"
	shift ; shift
	;;
    -*)
	opts="`echo $opts $1`"
	shift
	;;
     *)
	pkgs="`echo $pkgs $1`"
	shift
     ;;
  esac
done

#echo "opts= $opts"
#echo "pkgs= $pkgs"

for i in $pkgs ; do
   if [ -d $i ]; then
	cd $i
	for j in * ; do
		installpkg -priority ADD $opts $j 
	done
	cd ..
   else
	installpkg2 $opts $i
   fi
done
