#!/bin/sh

###
###  Copyright 2000-2007 University of Illinois Board of Trustees
###  All rights reserved.
###
###  preinstall - pre install script for use with most package
###                 management systems (SVR4, encap, FreeBSD Pakages/Ports)
###
###  Campus Information Technologies and Educational Services
###  University of Illinois at Urbana-Champaign
###

err=0

#
# Solaris specific tweaks...
#
if [ -n "${PKGINST}" ]; then

     #
     # Temp hack to install new package dependencies for UIUCpsgconf
     # Need versions so that curl finds the files on the ftp server :(
     #
     PKGLIST=""

     for pkg in $PKGLIST; do

          # Check to see if the package was already installed
          pkginfo -q `echo $pkg | sed -e 's/-[^-]*$//'`
          if [ $? -ne 0 ]; then

			echo "Prerequisites are missing ($pkg)"
			echo ""
			err=1
          fi
     done
fi

if [ -n "${ENCAP_SOURCE}" ]; then
     PKGLIST=""

	for pkg in $PKGLIST; do
     	epkg -qk $pkg > /dev/null 2>&1
     	if [ $? -ne 0 ]; then
          	epkg -u $pkg
			if [ $? -ne 0 ]; then
				err=1
			fi
     	fi
	done
fi

exit $err


syntax highlighted by Code2HTML, v. 0.9.1