d8e0a7a29e2c36d59383cce1ddfd91bc66f25ce9 max Sat Dec 30 07:44:27 2023 -0800 removing stray help text at end of browserSetup.sh script, email from Dwayne McCully, refs #32693 diff --git src/product/installer/browserSetup.sh src/product/installer/browserSetup.sh index c93eae8..13b8b0c 100644 --- src/product/installer/browserSetup.sh +++ src/product/installer/browserSetup.sh @@ -677,61 +677,96 @@ cd samtabix make # compile the genome browser CGIs cd $APACHEDIR/kent/src make libs make cgi-alpha cd hg/dbTrash make #cd hg/htdocs #make doInstall destDir=$APACHDIR/htdocs FIND="find ." # dbTrash tool needed for trash cleaning } +# This should not be needed anymore: hgGeneGraph has moved to Python3 finally. But leaving the code in here +# anyways, as it should not hurt and some mirrors may have old Python2 code or old CGIs around. +# We can remove this section in around 1-2 years when we are sure that no one needs Python2 anymore +function installPy2MysqlRedhat () { + yum install -y python2 mysql-devel python2-devel wget gcc + 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 + + # this is very strange, but was necessary on Fedora https://github.com/DefectDojo/django-DefectDojo/issues/407 + # somehow the mysql.h does not have the "reconnect" field anymore in Fedora + if grep -q "bool reconnect;" /usr/include/mysql/mysql.h ; then + echo /usr/include/mysql/mysql.h already has reconnect attribute + else + sed '/st_mysql_options options;/a my_bool reconnect; // added by UCSC Genome browserSetup.sh script' /usr/include/mysql/mysql.h -i.bkp + fi + + # fedora > 34 doesn't have any pip2 package anymore so install it now + if ! type "pip2" > /dev/null; then + wget https://bootstrap.pypa.io/pip/2.7/get-pip.py + python2 get-pip.py + mv /usr/bin/pip /usr/bin/pip2 + + fi + pip2 install MySQL-python + } + +# little function that compares two floating point numbers +# see https://stackoverflow.com/questions/8654051/how-can-i-compare-two-floating-point-numbers-in-bash +function numCompare () { + awk -v n1="$1" -v n2="$2" 'BEGIN {printf (n1<n2?"<":">=") }' +} + # 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 yum -y update # Fedora doesn't have or need EPEL, however, it does not include chkconfig by default if cat /etc/redhat-release | grep edora > /dev/null; then yum -y install chkconfig else yum -y install epel-release fi yum -y install ghostscript rsync ImageMagick R-core curl # centos 7 does 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 + yum -y install httpd chkconfig # start apache on boot chkconfig --level 2345 httpd on # there will be an error message that the apache # mkdir -p $APACHEDIR/htdocs service httpd start else echo2 Apache already installed fi # create the apache config if [ ! -f $APACHECONF ]; then echo2 echo2 Creating the Apache2 config file $APACHECONF waitKey @@ -746,32 +781,30 @@ if [ -f /etc/init.d/iptables ]; then echo2 Opening port 80 for incoming connections to Apache waitKey iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT iptables -I INPUT 1 -p tcp --dport 443 -j ACCEPT service iptables save service iptables restart fi # MYSQL INSTALL ON REDHAT # centos7 provides only a package called mariadb-server # Mysql 8 does not allow copying MYISAM files anymore into the DB. # -> we cannot support Mysql 8 anymore - #if yum list mysql-server 2> /dev/null ; then - #MYSQLPKG=mysql-server if yum list mariadb-server 2> /dev/null ; then MYSQLPKG=mariadb-server else echo2 Cannot find a mysql-server package in the current yum repositories exit 100 fi # even mariadb packages currently call their main wrapper /usr/bin/mysqld_safe if [ ! -f /usr/bin/mysqld_safe ]; then echo2 echo2 Installing the Mysql or MariaDB server and make it start at boot. waitKey moveAwayMyCnf yum -y install $MYSQLPKG @@ -795,55 +828,41 @@ 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 install 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 simply does not have my_config.h else - yum install -y python2 mysql-devel python2-devel wget gcc - if [ -f /usr/include/mysql/my_config.h ]; then - echo my_config.h found + if [ `numCompare $VERNUM 9` == "<" ] ; then + installPy2MysqlRedhat else - wget https://raw.githubusercontent.com/paulfitz/mysql-connector-c/master/include/my_config.h -P /usr/include/mysql/ - fi - - # this is very strange, but was necessary on Fedora https://github.com/DefectDojo/django-DefectDojo/issues/407 - # somehow the mysql.h does not have the "reconnect" field anymore in Fedora - if grep -q "bool reconnect;" /usr/include/mysql/mysql.h ; then - echo /usr/include/mysql/mysql.h already has reconnect attribute - else - sed '/st_mysql_options options;/a my_bool reconnect; // added by UCSC Genome browserSetup.sh script' /usr/include/mysql/mysql.h -i.bkp + echo Not install Python2, this Linux does not have it and it should not be needed anymore fi - - # fedora > 34 doesn't have any pip2 package anymore so install it now - if ! type "pip2" > /dev/null; then - wget https://bootstrap.pypa.io/pip/2.7/get-pip.py - python2 get-pip.py - mv /usr/bin/pip /usr/bin/pip2 - - fi - pip2 install MySQL-python fi + # open port 80 in firewall + if [ $VER + sudo firewall-cmd --zone=public --permanent --add-service=http + sudo firewall-cmd --reload } # 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 100 @@ -1356,31 +1375,31 @@ $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 100 fi echo '--------------------------------' echo UCSC Genome Browser installation echo '--------------------------------' - echo Detected OS: $OS/$DIST, $VER + echo Detected OS: $OS/$DIST, Version $VERNUM, Release: $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 "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 @@ -1728,30 +1747,36 @@ echo2 Hiding some tracks by default and removing some tracks from searches for db in $DBS; do echo $db if [ "$db" == "go" -o "$db" == "uniProt" -o "$db" == "visiGene" -o "$db" == "hgFixed" -o "$db" == "proteome" ] ; then continue fi for track in $hideTracks; do mysql $db -e 'UPDATE trackDb set visibility=0 WHERE tableName="'$track'"' done for track in $notSearchTables; do mysql $db -e 'DELETE from hgFindSpec WHERE searchTable="'$track'"' done done + + # cannot activate this part, not clear what to do when mirror goes offline or online + # now fix up trackDb, remove rows of tracks that this mirror does not have locally + #for db in `mysql -NB -e 'show databases' | egrep 'proteome|uniProt|visiGene|go$|hgFixed'`; do + #fixTrackDb $db trackDb; + #done } # only download a set of minimal mysql tables, to make a genome browser that is using the mysql failover mechanism # faster. This should be fast enough in the US West Coast area and maybe even on the East Coast. function downloadMinimal { DBS=$* if [ "$DBS" == "" ] ; then echo2 Argument error: the '"minimal"' command requires at least one assembly name, like hg19 or mm10. exit 100 fi echo2 echo2 Downloading minimal tables for databases $DBS @@ -1997,30 +2022,40 @@ elif [[ -f /etc/redhat-release ]] ; then DIST=redhat VER=$(cat /etc/redhat-release) APACHECONF=/etc/httpd/conf.d/001-browser.conf APACHEUSER=apache elif [[ -f /etc/os-release ]]; then # line looks like this on Amazon AMI Linux: 'ID_LIKE="rhel fedora"' source /etc/os-release if [[ $ID_LIKE == rhel* ]]; then DIST=redhat VER=$VERSION APACHECONF=/etc/httpd/conf.d/001-browser.conf APACHEUSER=apache fi fi + + VERNUM=0 + # only works on redhats IMHO + if [ -f /etc/system-release-cpe ] ; then + VERNUM=`cut /etc/system-release-cpe -d: -f5` + fi + # os-release should work everywhere and has the full version number + if [ -f /etc/os-release ] ; then + VERNUM=`cat /etc/os-release | grep VERSION_ID | cut -d= -f2 | tr -d '"'` + fi fi if [ "$DIST" == "none" ]; then echo Sorry, unable to detect your linux distribution. echo Currently only Debian and Redhat-style distributions are supported. exit 100 fi lastArg=${*: -1:1} if [[ "$#" -gt "1" && ( "${2:0:1}" == "-" ) || ( "${lastArg:0:1}" == "-" ) ]]; then echo "Error: The options have to be specified before the command, not after it." echo echo "$HELP_STR" exit 100 fi