1c23711ef09245b7f38f327200a7b5bebd10a4cc
max
  Thu Oct 8 03:38:48 2020 -0700
fixing up GBIC installer for Centos 8, refs #26320

diff --git src/product/installer/browserSetup.sh src/product/installer/browserSetup.sh
index 1859b8a..18197c1 100755
--- src/product/installer/browserSetup.sh
+++ src/product/installer/browserSetup.sh
@@ -601,34 +601,33 @@
     cd hg/dbTrash
     make
 
     #cd hg/htdocs
     #make doInstall destDir=$APACHDIR/htdocs FIND="find ."
     # dbTrash tool needed for trash cleaning
 }
 
 # redhat specific part of mysql and apache installation
 function installRedhat () {
     echo2 
     echo2 Installing EPEL, ghostscript, libpng
     waitKey
     # make sure we have and EPEL and ghostscript and rsync (not installed on vagrant boxes)
     # imagemagick is required for the session gallery
-    # MySQL-python is required for hgGeneGraph
-    yum update
+    yum -y update
     yum -y install epel-release
-    yum -y install ghostscript rsync ImageMagick R-core MySQL-python curl
+    yum -y install ghostscript rsync ImageMagick R-core curl
 
     # centos 7 and fedora 20 do not provide libpng by default
     if ldconfig -p | grep libpng12.so > /dev/null; then
         echo2 libpng12 found
     else
         yum -y install libpng12
     fi
     
     # install apache if not installed yet
     if [ ! -f /usr/sbin/httpd ]; then
         echo2
         echo2 Installing Apache and making it start on boot
         waitKey
         yum -y install httpd
         # start apache on boot
@@ -691,30 +690,48 @@
         if [[ $MYSQLVER =~ "MariaDB" ]]; then
             MYSQLD=mariadb
         fi
             
         # start mysql on boot
         chkconfig --level 2345 $MYSQLD on 
 
         # start mysql now
         /sbin/service $MYSQLD start
 
         secureMysql
         SET_MYSQL_ROOT=1
     else
         echo2 Mysql already installed
     fi
+
+    # MySQL-python is required for hgGeneGraph
+    # CentOS up to and including 7 default to python2, so MySQL-python is in the repos
+    if yum list MySQL-python 2> /dev/null ; then
+            yum -y MySQL-python
+    # Centos 8 defaults to python3 and it does not have a package MySQL-python anymore
+    # So we install python2, the mysql libraries and fix up my_config.h manually
+    # This is strange, but I was unable to find a different working solution. MariaDB does not have my_config.h
+    else
+            yum install -y python2 mysql-devel python2-devel wget
+            if [ -f /usr/include/mysql/my_config.h ]; then
+                    echo my_config.h found
+            else
+                wget https://raw.githubusercontent.com/paulfitz/mysql-connector-c/master/include/my_config.h -P /usr/include/mysql/
+            fi
+            pip2 install MySQL-python
+    fi
+
 }
 
 # OSX specific setup of the installation
 function installOsx () 
 {
    # check for xcode
    if [ -f /usr/bin/xcode-select 2> /dev/null > /dev/null ]; then
        echo2 Found XCode
    else
        echo2
        echo2 'This installer has to compile the UCSC tools locally on OSX.'
        echo2 'Please install XCode from https://developer.apple.com/xcode/downloads/'
        echo2 'Start XCode once and accept the Apple license.'
        echo2 'Then run this script again.'
        exit 101
@@ -1143,87 +1160,89 @@
     $MYSQL -e 'CREATE DATABASE IF NOT EXISTS hgFixed;' # empty db needed for gencode tracks
     downloadFile http://$HGDOWNLOAD/admin/hgcentral.sql | $MYSQL hgcentral
     # the blat servers don't have fully qualified dom names in the download data
     $MYSQL hgcentral -e 'UPDATE blatServers SET host=CONCAT(host,".soe.ucsc.edu");'
     
     echo2
     echo2 "Will now grant permissions to browser database access users:"
     echo2 "User: 'browser', password: 'genome' - full database access permissions"
     echo2 "User: 'readonly', password: 'access' - read only access for CGI binaries"
     echo2 "User: 'readwrite', password: 'update' - readwrite access for hgcentral DB"
     waitKey
     
     #  Full access to all databases for the user 'browser'
     #       This would be for browser developers that need read/write access
     #       to all database tables.  
+    $MYSQL -e "CREATE USER browser@localhost IDENTIFIED BY 'genome';"
     $MYSQL -e "GRANT SELECT, INSERT, UPDATE, DELETE, FILE, "\
-"CREATE, DROP, ALTER, CREATE TEMPORARY TABLES on *.* TO browser@localhost "\
-"IDENTIFIED BY 'genome';"
+"CREATE, DROP, ALTER, CREATE TEMPORARY TABLES on *.* TO browser@localhost; "
     
     # FILE permission for this user to all databases to allow DB table loading with
     #       statements such as: "LOAD DATA INFILE file.tab"
     # For security details please read:
     #       http://dev.mysql.com/doc/refman/5.1/en/load-data.html
     #       http://dev.mysql.com/doc/refman/5.1/en/load-data-local.html
-    $MYSQL -e "GRANT FILE on *.* TO browser@localhost IDENTIFIED BY 'genome';" 
+    $MYSQL -e "GRANT FILE on *.* TO browser@localhost;" 
     
     #   Read only access to genome databases for the browser CGI binaries
+    $MYSQL -e "CREATE USER readonly@localhost IDENTIFIED BY 'access';"
     $MYSQL -e "GRANT SELECT, CREATE TEMPORARY TABLES on "\
-"*.* TO readonly@localhost IDENTIFIED BY 'access';"
+"*.* TO readonly@localhost;"
     $MYSQL -e "GRANT SELECT, INSERT, CREATE TEMPORARY TABLES on hgTemp.* TO "\
-"readonly@localhost IDENTIFIED BY 'access';"
+"readonly@localhost;"
     
     # Readwrite access to hgcentral for browser CGI binaries to keep session state
+    $MYSQL -e "CREATE USER readwrite@localhost IDENTIFIED BY 'update';"
     $MYSQL -e "GRANT SELECT, INSERT, UPDATE, "\
-"DELETE, CREATE, DROP, ALTER on hgcentral.* TO readwrite@localhost "\
-"IDENTIFIED BY 'update';"
+"DELETE, CREATE, DROP, ALTER on hgcentral.* TO readwrite@localhost; "
     
     # create /gbdb and let the apache user write to it
     # hgConvert will download missing liftOver files on the fly and needs write
     # write access
     mkdir -p $GBDBDIR
     chown $APACHEUSER:$APACHEUSER $GBDBDIR
     
     # the custom track database needs it own user and permissions
+    $MYSQL -e "CREATE USER ctdbuser@localhost IDENTIFIED BY 'ctdbpassword';"
     $MYSQL -e "GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX "\
-"on customTrash.* TO ctdbuser@localhost IDENTIFIED by 'ctdbpassword';"
+"on customTrash.* TO ctdbuser@localhost;"
     
     # removed these now for the new hgGateway page, Apr 2016
     # by default hgGateway needs an empty hg19 database, will crash otherwise
     # $MYSQL -e 'CREATE DATABASE IF NOT EXISTS hg19'
     # mm9 needs an empty hg18 database
     $MYSQL -e 'CREATE DATABASE IF NOT EXISTS hg18'
     
     $MYSQL -e "FLUSH PRIVILEGES;"
 }
 
 # main function, installs the browser on Redhat/Debian and potentially even on OSX
 function installBrowser () 
 {
     if [ -f $COMPLETEFLAG ]; then
         echo2 error: the file $COMPLETEFLAG exists. It seems that you have installed the browser already.
         exit 246
     fi
 
     echo '--------------------------------'
     echo UCSC Genome Browser installation
     echo '--------------------------------'
     echo Detected OS: $OS/$DIST, $VER
     echo 
     echo This script will go through three steps:
     echo "1 - setup apache and mysql, open port 80, deactivate SELinux"
-    echo "2 - copy CGI binaries into $CGIBINDIR, html files into HTDOCDIR"
+    echo "2 - copy CGI binaries into $CGIBINDIR, html files into $HTDOCDIR"
     echo "3 - optional: download genome assembly databases into mysql and /gbdb"
     echo
     echo This script will now install and configure Mysql and Apache if they are not yet installed. 
     echo "Your distribution's package manager will be used for this."
     echo If Mysql is not installed yet, it will be installed, secured and a root password defined.
     echo
     echo This script will also deactivate SELinux if active and open port 80/http.
     waitKey
 
     # -----  OS - SPECIFIC part -----
     if [ ! -f $COMPLETEFLAG ]; then
        if [[ "$DIST" == "OSX" ]]; then
           installOsx
        elif [[ "$DIST" == "debian" ]]; then
           installDebian