fe0f5e6f44da6757e1a12312a875c98af7396278
chmalee
  Wed Feb 21 12:51:23 2018 -0800
GBIB: Fixing typo in R install and fixing genome-euro redirect after more feedback from Gokhul

diff --git src/browserbox/root/updateBrowser.sh src/browserbox/root/updateBrowser.sh
index a216831..4a53848 100755
--- src/browserbox/root/updateBrowser.sh
+++ src/browserbox/root/updateBrowser.sh
@@ -209,31 +209,31 @@
 rm -f /root/gbibSkipNextUpdate
 
 # The original GBiB image did not use the Ubuntu Virtualbox guest utils but the
 # ones from VirtualBox in /opt. Fix this now and switch to the Ubuntu guest
 # utilities, so they are updated automatically by the Ubuntu tools
 if apt-cache policy virtualbox-guest-dkms | grep "Installed: .none." > /dev/null; then
     echo - Updating VirtualBox Guest utilities
     apt-get install -y linux-headers-generic 
     apt-get install -y virtualbox-guest-dkms
     apt-get -y autoremove
     /etc/init.d/vboxadd start
 
 fi
 
 # install R for the gtex tracks
-if apt-cache policy r-base | grep "Installed: .none." > /dev/null; then
+if apt-cache policy r-base-core | grep "Installed: .none." > /dev/null; then
    echo - Installing R
    apt-get update
    apt-get --no-install-recommends install -y r-base-core
    apt-get -y autoremove
 fi
 
 # install imagemagick for the session gallery
 if apt-cache policy imagemagick | grep "Installed: .none." > /dev/null; then
    echo - Installing imagemagick
    apt-get update
    apt-get --no-install-recommends install -y imagemagick
    apt-get -y autoremove
 fi
 
 # install mysql-python for hgGeneGraph, actually cgi-bin/pyLib/hgLib.py
@@ -465,31 +465,34 @@
 
 #LATENCY=`ping genome.ucsc.edu -n -c1 -q | grep rtt | cut -d' ' -f4 | cut -d/ -f2 | cut -d. -f1`
 #if [ "$LATENCY" -gt "90" ]; then
 #echo making low-latency changes
 /usr/local/apache/cgi-bin/hgMirror postRsyncUpdates
 
 # the local-only hg.conf settings file has to exist as it is included from hg.conf
 # In case it got deleted due to some error, recreate it
 if [ ! -f /usr/local/apache/cgi-bin/hg.conf.local ] ; then
    echo Creating /usr/local/apache/cgi-bin/hg.conf.local
    echo allowHgMirror=true > /usr/local/apache/cgi-bin/hg.conf.local
 fi
 
 # Sept 2017: check if genome-euro mysql server is closer
 if [ ! -f /usr/local/apache/trash/registration.txt ]; then
+   curl -sSI genome-euro.ucsc.edu 2>&1 > /dev/null
+   if [[ $? -eq 0 ]]; then
       echo comparing latency: genome.ucsc.edu Vs. genome-euro.ucsc.edu
       euroSpeed=$( (time -p (for i in `seq 10`; do curl -sSI genome-euro.ucsc.edu > /dev/null; done )) 2>&1 | grep real | cut -d' ' -f2 )
-   ucscSpeed=$( (time -p (for i in `seq 10`; do curl -sSI genome.ucsc.edu /dev/null; done )) 2>&1 | grep real | cut -d' ' -f2 )
+      ucscSpeed=$( (time -p (for i in `seq 10`; do curl -sSI genome.ucsc.edu > /dev/null; done )) 2>&1 | grep real | cut -d' ' -f2 )
       if [[ $(awk '{if ($1 <= $2) print 1;}' <<< "$euroSpeed $ucscSpeed") -eq 1 ]]; then
          echo genome-euro seems to be closer
          echo modifying gbib to pull data from genome-euro instead of genome
          sed -i s/slow-db.host=genome-mysql.cse.ucsc.edu/slow-db.host=genome-euro-mysql.soe.ucsc.edu/ /usr/local/apache/cgi-bin/hg.conf
       else
          echo genome.ucsc.edu seems to be closer
          echo not modifying /usr/local/apache/cgi-bin/hg.conf
       fi
    fi
+fi
 
 touch /root/lastUpdateTime.flag
 echo - GBiB update done
 cat /etc/issue | tr -s '\n'