54195fff8bba3952c7fe45c9a228cbe7ab4855cc
max
  Mon Feb 5 08:05:54 2024 -0800
adding development mode to GBIC script, refs #32762

diff --git src/product/installer/browserSetup.sh src/product/installer/browserSetup.sh
index 23eff32..35a6523 100644
--- src/product/installer/browserSetup.sh
+++ src/product/installer/browserSetup.sh
@@ -1,24 +1,23 @@
 #!/bin/bash
 
 # script to install/setup dependencies for the UCSC genome browser CGIs
 # call it like this as root from a command line: bash browserSetup.sh
 
 # you can easily debug this script with 'bash -x browserSetup.sh', it 
 # will show all commands then
 
-# keep a log file in browserSetup.log
 exec > >(tee -a "${HOME}/browserSetup.log") 2>&1
 
 set -u -e -o pipefail # fail on unset vars and all errors, also in pipes
 
 # set all locale settings to English
 # searching for certain strings in command output might fail, if locale is different
 export LANG=C
 
 exitHandler() {
     if [ "$1" == "100" -o "$1" == "0" ] ; then
        exit $1 # all fine, a specific error message has already been output
     fi
 
     # somehow this script exited with an unknown type of error code
     echo Exit error $1 occurred on line $2
@@ -731,39 +730,44 @@
 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 initscripts --allowerasing
+    yum -y install ghostscript rsync ImageMagick R-core curl initscripts --allowerasing --nobest
 
     # 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
     
+    # try to activate the powertools repo. Exists on CentOS and Rocky but not Redhat
+    set -e
+    yum config-manager --set-enabled powertools
+    set +e
+    
     # 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 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
@@ -1373,30 +1377,56 @@
     
     # 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;"
     
     # 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;"
 }
 
+# set this machine for browser development: install required tools, clone the tree, build it
+function buildTree () 
+{
+   echo2 Installing required linux packages from repositories: Git, GCC, G++, Mysql-client-libs, etc
+   waitKey
+   if [[ "$DIST" == "debian" ]]; then
+      yum install -y git vim gcc gcc-c++ make libpng-devel libuuid-devel freetype-devel
+   elif [[ "$DIST" == "redhat" ]]; then
+      apt-get install make git gcc g++ libpng-dev libmysqlclient-dev uuid-dev
+   else 
+      echo Error: Cannot identify linux distribution
+      exit 100
+   fi
+
+   echo2 Cloning kent repo into ~/kent using git with --depth=1
+   waitKey
+   cd ~
+   git clone https://github.com/ucscGenomeBrowser/kent.git --depth=1
+
+   echo2 Now building CGIs from ~/kent to /usr/local/apache/cgi-bin 
+   echo2 Copying JS/HTML/CSS to /usr/local/apache/htdocs
+   waitKey
+   cd ~/kent/src
+   make -j8 cgi-alpha
+}
+
 # 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.
         echo2 If you want to reset the Apache directory, you can run '"rm -rf /usr/local/apache"' and 
         echo2 then run this script again.
         exit 100
     fi
 
     echo '--------------------------------'
     echo UCSC Genome Browser installation
     echo '--------------------------------'
     echo Detected OS: $OS/$DIST, Version $VERNUM, Release: $VER
     echo 
@@ -2099,20 +2129,23 @@
 elif [ "${1:-}" == "cgiUpdate" ]; then
    cgiUpdate
 
 elif [ "${1:-}" == "update" ]; then 
    updateBrowser ${@:2} # all arguments after the second one
 
 elif [ "${1:-}" == "clean" ]; then
     cleanTrash
 
 elif [ "${1:-}" == "addTools" ]; then
     addTools
 
 elif [ "${1:-}" == "mysql" ]; then
     mysqlDbSetup
 
+elif [ "${1:-}" == "dev" ]; then
+    buildTree 
+
 else
    echo Unknown command: $1
    echo "$HELP_STR"
    exit 100
 fi