#!/bin/sh
# $RootCheck: installpkg ,v 1.0 2003/10/20, Gabriel$
# Installation script for RootCheck (Perl Modules)
# Taken from install (little bit modified by Daniel B. Cid)

cd ./pkgs
FILE=$1;
  echo $FILE | awk '{
    eeks="";
    file=$0;
    if($0 ~ /\.gz$/) {
        printf("\nUncompressing %s\n",$0);
        if(system("gzip -d "$0) != 0) {
            printf("Opps, could not ungzip %s\n",$0);
            exit 1;
        }
        file = gensub(/\.gz$/,eeks,1);
    }
    printf("\nOpening tarball %s\n",file);
    if(system("tar xfv "file) != 0) {
        printf("Opps, could not untar %s\n",file);
        exit 1;
    }
  }'
for DIR in `ls` ;
do
  if [ -d $DIR ] ; then
                                                                                
    cd $DIR
    perl Makefile.PL && make && make install
                                                                                
    if [ $? -ne 0 ]; then
      echo ""
      echo "Could not install package $DIR"
    else
      echo ""
      echo "Installation of package $DIR sucessfull"
    fi
    cd ../
rm -rf $DIR                                                                     
  fi
done
  cd ../
