. locations.include
if [ ! -f ../../base/pkgorder ] ; then
   echo "You do not have ../../base/pkgorder so am running pkgorder to make one"
   echo "This will take quite a long time"
   $ANACONDADIR/pkgorder $TREE $ARCH $DEFAULT > ../../base/pkgorder
fi
echo "Running genhdlist now"
$ANACONDADIR/genhdlist $1 --fileorder ../../base/pkgorder --default $DEFAULT $TREE  2> /tmp/genhdlist.out
if [ -f /tmp/genhdlist.out ] ; then
	grep -q "ordering not found" /tmp/genhdlist.out
        if [ $? = 0 ] ; then
   		echo "Your ../../base/pkgorder is out of date, making a new one"
   		echo "This will take quite a long time"
   		$ANACONDADIR/pkgorder $TREE $ARCH $DEFAULT > ../../base/pkgorder
		echo "Running genhdlist again, since we just make a new ../../base/pkgorder"
		$ANACONDADIR/genhdlist $1 --fileorder ../../base/pkgorder --default $DEFAULT $TREE
	fi
	grep -v "ordering not found" /tmp/genhdlist.out
	rm /tmp/genhdlist.out
fi
