echo "Hello, this is FermiStandAlone" > /tmp/FermiStandAlone

########################################################################
# Check to see if we are on the network
if ping -q -c 1 -w 2 131.225.111.89 > /dev/null 2>&1; then
  echo "  Found a network.. "

  ######################################################################
  # Make sure we can do a name lookupg
  if grep -q nameserver /etc/resolv.conf ; then
    echo "  Found a nameserver.. "
  else
    echo "  Nameserver not found ... adding one.. "
	echo "nameserver 131.225.17.150" >> /etc/resolv.conf
  fi

  if ping -q -c 1 -w 2 linux.fnal.gov > /dev/null 2>&1; then
    echo "  Network setup properly: Updating system with yum: "
  
    ######################################################################
    # Use yum to bring itself up to date.
    echo "1 ... updating yum "
    yum -y update yum yum-conf > /dev/null 2>&1

    ######################################################################
    # Now use yum to update everything we can lay our hands on
    echo "2 ... updating everything else"
    yum -y update > /dev/null 2>&1
  
    exit 0

  else
    ######################################################################
    # Notify the user that we weren't able to do their updates
    echo "We could not do a name lookup of linux.fnal.gov"
    echo "We could not do a name lookup of linux.fnal.gov" > /root/NO.UPDATE.DONE
  fi

else
  ######################################################################
  # Notify the user that we weren't able to do their updates
  echo "We could not reach the network"
  echo "We could not reach the network" > /root/NO.UPDATE.DONE
fi
########################################################################
