dd068eb5ec7e21a361881518502897c8fb7b19ae
max
  Tue Jan 27 01:37:08 2015 -0800
adding possibility to force auto updates to off in gbib, refs #14602

diff --git src/browserbox/root/updateBrowser.sh src/browserbox/root/updateBrowser.sh
index d646eb9..0d9a2b7 100755
--- src/browserbox/root/updateBrowser.sh
+++ src/browserbox/root/updateBrowser.sh
@@ -3,54 +3,43 @@
 # update script on the box
 # - updates itself and then run itself
 # - updates cgis, html and gbdb via rsync 
 # - updates hg.conf via wget
 # - patches the menu
 # - hides conservation+retro 
 # - removes some searches if latency to UCSC is > 90msecs
 
 # will not run if:
 # - not run as root
 # - if a script named updateBrowser.sh already is running
 # - any hgMirror jobs are running
 # - hgdownload is offline
 # - if a flagFile on hgDownload is not more recent than a local flag file
 
-# an interrupted update script will not touch the local flagfile, so they will
-# be restarted after the next reboot or when the cronjob is run, whichever
-# comes first
-
-# To find out why the script did not run, use the command echo $? to show the
-# exit code of the script
-
 # parameters:
 # - parameter "hgwdev": does not update itself, copies only the beta/alpha CGIs/htdocs from hgwdev
 # - parameter "notSelf": does not update itself and does not check flagfile
 
-# this script is not using the bash options pipefail or errabort.
-# In case something goes wrong it continues, this is intentional to 
-# avoid a machine that does not update itself anymore
-
-# rsync options help:
+# rsync options:
 # l = preserve symlinks
 # t = preserve time
 # r = recurse
 # z = compress
 # v = verbose
 # h = human readable
 # u = skip if file is newer on receiver
-RSYNCOPTS="-ltrzvh --partial"
+RSYNCOPTS="-ltrzvh"
 # rsync server for CGIs and html files
 RSYNCSRC="rsync://hgdownload.cse.ucsc.edu"
 RSYNCCGIBIN=cgi-bin
 RSYNCHTDOCS=htdocs
 UPDATEFLAG=http://hgdownload.cse.ucsc.edu/gbib/lastUpdate
 
 # help
 if [ "$1" == "-h" ] ; then
    echo "Without any options, this script checks if it can reach hgdownload and if "
    echo "new data has been added since the last run. It updates itself and runs the new copy."
    echo "The new copy rsyncs the CGIs/MysqlDbs/htdocs from hgdownload."
    echo "It rsyncs the gbib/push directory into / to update other files."
    echo "It finally repairs mysql tables, makes some trackDb changes, adds symlinks,"
    echo "and chmods the directories."
    echo "Parameters:"
@@ -61,30 +50,35 @@
 fi
 
 # check if running as root
 if [ "$(id -u)" != "0" ] ; then
    echo "This script must be run as root" 1>&2
    exit 1
 fi
 
 # check if running already, 3 = the main script + its update + the subshell where this command is running
 RUNNING=`ps --no-headers -CupdateBrowser.sh | wc -l`
 if [ ${RUNNING} -gt 3 ] ; then
     #echo update already running
     exit 2
 fi
 	
+# check if auto-updates were deactivated from the Vbox host via a property
+if VBoxControl guestproperty get gbibAutoUpdateOff | grep -xq "Value: yes" ; then
+    exit 6
+fi
+
 # check if we have internet
 wget -q --tries=1 --timeout=10 --spider http://hgdownload.soe.ucsc.edu -O /dev/null
 if [ $? -ne 0 ] ; then
     exit 3
 fi
 
 # check flag if run with no parameter (=from cron)
 if [ "$#" -eq 0 ] ; then
    # check a flag file to see if anything on hgdownload actually changed
    if /root/urlIsNotNewerThanFile $UPDATEFLAG /root/lastUpdateTime.flag
    then
        exit 0
    fi
 fi
 
@@ -147,44 +141,38 @@
   
     # remove things that are on hgwdev beta directories but not necessary on the gbib
     if [ "$dirExt" == "beta" ] ; then
       RSYNCAPACHE="$RSYNCAPACHE --exclude favicon*.ico --exclude hg.conf* --exclude ENCODE --exclude *.gz --exclude *.bw --exclude *.bb --exclude *.bam --exclude goldenPath/**.pdf --exclude admin --exclude goldenPath/customTracks --exclude pubs --exclude ancestors --exclude training --exclude trash --exclude .htaccess --exclude htdocs --exclude Neandertal --exclude RNA-img --exclude ebola --exclude encodeDCC --exclude evoFold --exclude geneExtra --exclude js-public --exclude style-public --exclude hgNearData --exclude visiGeneData --exclude visiGene"
     fi
 
     rsync $RSYNCAPACHE $user@hgwdev.soe.ucsc.edu:/usr/local/apache/htdocs${htmlExt}/ /usr/local/apache/htdocs/
     rsync $RSYNCAPACHE $user@hgwdev.soe.ucsc.edu:/usr/local/apache/cgi-bin${cgiExt}/ /usr/local/apache/cgi-bin/
 
     PUSHLOC=$user@hgwdev.soe.ucsc.edu:/usr/local/apache/htdocs/gbib/push/
 
 # normal public updates from hgdownload are easier, not many excludes necessary
 else
     # update CGIs
     echo updating CGIs...
-    rsync --delete -u $RSYNCOPTS $RSYNCSRC/$RSYNCCGIBIN /usr/local/apache/cgi-bin/ --exclude=hg.conf --exclude=hg.conf.local --exclude edw* --exclude *private --exclude hgNearData --exclude visiGeneData --exclude Neandertal 
+    rsync --delete $RSYNCOPTS $RSYNCSRC/$RSYNCCGIBIN /usr/local/apache/cgi-bin/ --exclude=hg.conf --exclude edw* --exclude *private --exclude hgNearData --exclude visiGeneData --exclude Neandertal 
 
     echo updating HTML files...
-    rsync --delete -u $RSYNCOPTS $RSYNCSRC/$RSYNCHTDOCS/ /usr/local/apache/htdocs/ --include **/customTracks/*.html --exclude ENCODE/ --exclude *.bam --exclude *.bb --exclude */*.bw --exclude */*.gz --exclude favicon.ico --exclude folders --exclude ancestors --exclude admin --exclude goldenPath/customTracks --exclude images/mammalPsg --exclude style/gbib.css --exclude images/title.jpg --exclude images/homeIconSprite.png --exclude goldenPath/**.pdf --exclude training
+    rsync --delete $RSYNCOPTS $RSYNCSRC/$RSYNCHTDOCS/ /usr/local/apache/htdocs/ --include **/customTracks/*.html --exclude ENCODE/ --exclude *.bam --exclude *.bb --exclude */*.bw --exclude */*.gz --exclude favicon.ico --exclude folders --exclude ancestors --exclude admin --exclude goldenPath/customTracks --exclude images/mammalPsg --exclude style/gbib.css --exclude images/title.jpg --exclude images/homeIconSprite.png --exclude goldenPath/**.pdf --exclude training
 
     PUSHLOC=hgdownload.cse.ucsc.edu::gbib/push/
 fi
 
-# hg.conf.local is not updated from hgdownload, but re-created if it does not exist
-if [ ! -f /usr/local/apache/cgi-bin/hg.conf.local ]; then
-    echo "Creating hg.conf.local"
-    echo allowHgMirror=false > /usr/local/apache/cgi-bin/hg.conf.local
-fi
-
 chown -R www-data.www-data /usr/local/apache/cgi-bin/*
 chown -R www-data.www-data /usr/local/apache/htdocs/
 chmod -R a+r /usr/local/apache/htdocs
 
 if [ "$1" != "hgwdev" ] ; then
   echo updating GBDB files...
   rsync $RSYNCOPTS --existing rsync://hgdownload.cse.ucsc.edu/gbdb/ /data/gbdb/
   chown -R www-data.www-data /data/gbdb/
 fi
 
 echo pulling other files
 rsync $RSYNCOPTS $PUSHLOC /
 
 if [ "$1" != "hgwdev" ] ; then
   echo updating MYSQL files - browser will not work during the MYSQL update