DISTARCH=i386
DEFAULT=SL
COMPSRPM=comps.rpm
WHERE=`pwd`
W1up=`dirname $WHERE`
W2up=`dirname $W1up`
if [ `basename $W2up` = "sites" ] ; then
   SITE=`basename $W1up`
   echo "SITE IS $SITE"
fi
W3up=`dirname $W2up`
if [ `basename $W3up` = "sites" ] ; then
   SITE=`basename $W2up`
   echo "SITE IS $SITE"
fi
BASEDIR=`dirname $W3up`
if [ -f  $WHERE/$COMPSRPM ] ; then
   BASEDIR=$WHERE
else
   if [ -f  $W1up/$COMPSRPM ] ; then
        BASEDIR=$W1up
   else
   	echo "Could not find $COMPSRPM"
	exit
   fi
fi
echo "making new comps.rpm"
rpmbuild -ba $BASEDIR/scripts/comps.site.spec
cp $BASEDIR/comps.rpm $BASEDIR/oldcomps/comps.rpm
DATE=`date +"%Y%m%d"`
cp -v /usr/src/redhat/RPMS/i386/comps-$SITE.301-0.$DATE.i386.rpm $BASEDIR/comps.rpm
