be4311c07e14feb728abc6425ee606ffaa611a58
markd
  Fri Jan 22 06:46:58 2021 -0800
merge with master

diff --git src/hg/makeDb/trackDb/loadTracks src/hg/makeDb/trackDb/loadTracks
index a155205..1e54af8 100755
--- src/hg/makeDb/trackDb/loadTracks
+++ src/hg/makeDb/trackDb/loadTracks
@@ -1,136 +1,143 @@
 #!/bin/bash -e
 usage='loadTracks [options] trackDb hgFindSpec db0 ...
 
 options:
    -release=release
    -strict
    -raName=trackDb.ra  - base name of ra file
    -grpSql=grp.sql - create a grp table using this sql file
-   -sqlDir=../../lib - directory containg trackDb.sql and hgFindSpec.sql'
+   -sqlDir=../../lib - directory containg trackDb.sql and hgFindSpec.sql
+   -remoteLogin=user@machine - machine with /gbdb on it'
 
 UNAME_N=`uname -n`
 UNAME_N=${UNAME_N/.soe.ucsc.edu/}
 release=''
 settings=''
 local=''
 strict=''
 raName=''
 grpSql=''
+remoteLogin=''
 sqlDir='../../lib'
 while [[ $1 == -* ]] ; do
     case $1 in
         -release=*)
             release=$(echo $1 | sed 's/-release=//') ;;
         -strict)
             strict=yes;;
         -settings)
             settings="yes";;
         -raName=*)
             raName=$(echo $1 | sed 's/-raName=//') ;;
         -grpSql=*)
             grpSql=$(echo $1 | sed 's/-grpSql=//') ;;
         -sqlDir=*)
             sqlDir=$(echo $1 | sed 's/-sqlDir=//') ;;
+        -remoteLogin=*)
+            remoteLogin=$(echo $1 | sed 's/-remoteLogin=//') ;;
         *)
             echo "invalid option: $1" >&2
             exit 1 ;;
     esac
     shift
 done
 
 if [ $# -lt 3 ] ; then
     echo "wrong # args: $usage" >&2
     exit 1
 fi
 
 trackDb="$1"; shift
 hgFindSpec="$1" ; shift
 dbs="$@"
 
 # check if a database exists, print note and return non-zero if it doesn't
 dbExists() {
     local db="$1"
     local dbChk=$(hgsql -Ne 'show databases like "'$db'"')
     if [ -z "$dbChk" ] ; then
         echo "Note: database $db does not exist, skipping"
         return 1
     else
         return 0
     fi
 }
 
 # load trackDb for a database
 loadDbTracks() {
     local db="$1"
     local dbpath=$(ls -1 -d */$db)
     local org=$(echo $dbpath | sed -e 's/\/.*//')
     local topts='' fopts='' qopts='-check'
     if [ -f $dbpath/visibility.ra ] ; then
         topts="$topts -visibility=$dbpath/visibility.ra"
     elif [ -f $org/visibility.ra ] ; then
         topts="$topts -visibility=$org/visibility.ra"
     fi
     if [ -f $dbpath/priority.ra ] ; then
         topts="$topts -priority=$dbpath/priority.ra"
     elif [ -f $org/priority.ra ] ; then
         topts="$topts -priority=$org/priority.ra"
     fi
     if [ -n "$release" ] ; then
         topts="$topts -release=$release"
         fopts="$fopts -release=$release"
         qopts="$qopts -release=$release"
     fi
     if [ -n "$strict" ] ; then
         topts="$topts -strict"
         fopts="$fopts -strict"
         qopts="$qopts -strict"
     fi
     if [ -n "$settings" ] ; then
         topts="$topts -settings"
     fi
     if [ -n "$raName" ] ; then
         topts="$topts -raName=$raName"
         fopts="$fopts -raName=$raName"
     fi
+    if [ -n "$remoteLogin" ] ; then
+        topts="$topts -remoteLogin=$remoteLogin"
+    fi
     # don't use set -x, since the autoload scripts e-mail stderr.
     local cmd="hgTrackDb $topts $org $db $trackDb ${sqlDir}/trackDb.sql ."
     echo $cmd
     eval $cmd
 
     cmd="tdbQuery $qopts 'select count(*) from $db' -root=`pwd`"
     echo $cmd
     eval $cmd
 
     cmd="hgFindSpec $fopts $org $db $hgFindSpec ${sqlDir}/hgFindSpec.sql ."
     echo $cmd
     eval $cmd
     if [ -z "$strict" -a -f $dbpath/description.html ] ; then
 	if [ "X${UNAME_N}Y" = "XhgwdevY" ]; then
 	    if [ ! -L /gbdb/$db/html -a -d /hive/data/genomes/$db/html ]; then
 		rm -f /gbdb/$db/html/description.html
 		rmdir /gbdb/$db/html
 		ln -s /hive/data/genomes/$db/html /gbdb/$db/html
 	    fi
 	    if [ -f /gbdb/$db/html/description.html ]; then
 		rm -f /gbdb/$db/html/description.html
 	    fi
 	fi
 	if [ $dbpath/description.html -nt /gbdb/$db/html/description.html ]; then
 	    rm -f /gbdb/$db/html/description.html
 	    cp -p $dbpath/description.html /gbdb/$db/html/description.html
 	fi
     fi
     if [ -n "$grpSql" ] ; then
         cmd="hgsql $db < $grpSql"
         echo $cmd
         eval $cmd
     fi
 }
 
 # load for all specified databases
 for db in $dbs ; do
     if dbExists $db ; then
         loadDbTracks $db
     fi
 done