. locations.include
PKGORDERFILE=$TREE/sites/$SITE/build/base/pkgorder
#
if [ -d $TREE/sites/$SITE/sites/$SITE ] ; then
   echo "removing $TREE/sites/$SITE/site/$SITE"
   rm $TREE/sites/$SITE/sites/$SITE
fi

if [ -s buildinstall ] ; then
  BUILDINSTALL=./buildinstall
else
  if [ -s $ANACONDADIR/buildinstall ] ; then
	BUILDINSTALL=$ANACONDADIR/buildinstall
  else
        echo "You need to have anaconda and anaconda-runtime installed"
        exit 1
  fi
fi
rm $TREE/sites/$SITE/.treeinfo
echo "running buildinstall now"
sh -x $BUILDINSTALL --pkgorder $PKGORDERFILE --version $VERSION --comps $TREE/sites/$SITE/RPMS/repodata/comps*xml --product "Scientific Linux $VERSION ($SITE)" --discs "1,2,3,4" --release $RELEASE --prodpath sites/$SITE/ $TREE

# buildinstall creates a .treeinfo in $TREE which is the SL part and not in the
# site area,  so we will move it to the site area.
cat $TREE/.treeinfo $TREE/sites/$SITE/.treeinfo > /tmp/treeinfo.tmp
cp /tmp/treeinfo.tmp $TREE/sites/$SITE/.treeinfo
rm $TREE/.treeinfo
 
if [ ! -d $TREE/sites/$SITE/sites/$SITE ] ; then
      mkdir -p $TREE/sites/$SITE/sites/
      cd $TREE/sites/$SITE/sites/
      ln -s .. $SITE
      cd $MYPWD
fi
if [ ! -d $TREE/images/$SITE ] ; then
  cd $TREE/images
  ln -s ../sites/$SITE/images $SITE 
  cd $MYPWD
fi


if [ $ARCH == "x86_64" ]; then

  echo "no customized boot images for $ARCH for now..."
 
else # i386
  echo "no customized boot images for $ARCH for now..."
fi
cd $MYPWD 
sh make.updates.img.sh
cd $MYPWD 
sh make.products.img.sh
