05868d7649db46f08e2fa8006ab29c75c4a8d980
maximilianh
  Fri May 2 14:34:34 2025 +0200
Gbic: cleaning up the apt-get init procedure. removing udr entirely for now. Making sure that curl is there, curl is tiny and always useful.

diff --git src/product/installer/browserSetup.sh src/product/installer/browserSetup.sh
index 2b07a345d16..11ad9e45baf 100755
--- src/product/installer/browserSetup.sh
+++ src/product/installer/browserSetup.sh
@@ -401,44 +401,45 @@
 
 All options have to precede the command.
 
 options:
   -a   - use alternative download server at Univ Bielefeld, Germany
          (used by default if faster ping time than to UCSC)
   -b   - batch mode, do not prompt for key presses
   -t   - For the "mirror" command: Track selection, requires a value.
          This option is only useful for Human/Mouse assemblies.
          Download only certain tracks, possible values:
          noEncode = do not download any tables with the wgEncode prefix, 
                     except Gencode genes, saves 4TB/6TB for hg19
          bestEncode = our ENCODE recommendation, all summary tracks, saves
                     2TB/6TB for hg19
          main = only Gencode genes and common SNPs, 5GB for hg19
-  -u   - use UDR (fast UDP) file transfers for the download.
-         Requires at least one open UDP incoming port 9000-9100.
-         (UDR is not available for Mac OSX)
-         This option will download a udr binary to /usr/local/bin
   -o   - switch to offline-mode. Remove all statements from hg.conf that allow
          loading data on-the-fly from the UCSC download server. Requires that
          you have downloaded at least one assembly, using the '"download"' 
          command, not the '"mirror"' command.
   -f   - switch to on-the-fly mode. Change hg.conf to allow loading data
          through the internet, if it is not available locally. The default mode
          unless an assembly has been provided during install
   -h   - this help message
 EOF_HELP
 
+#  -u   - use UDR (fast UDP) file transfers for the download.
+#         Requires at least one open UDP incoming port 9000-9100.
+#         (UDR is not available for Mac OSX)
+#         This option will download a udr binary to /usr/local/bin
+
 set -e
 
 # ----------------- END OF DEFAULT INLINE CONFIG FILES --------------------------
 
 # ----------------- UTILITY FUNCTIONS --------------------------
 
 # --- error handling --- 
 # add some highlight so it's easier to distinguish our own echoing from the programs we call
 function echo2 ()
 {
     command echo '|' "$@"
 }
 
 # download file to stdout, use either wget or curl
 function downloadFile ()
@@ -1015,49 +1016,56 @@
        chmod -R a+w $APACHEDIR/ext
        # only mysql does not tolerate world-writable conf files
        chmod a-w $APACHEDIR/ext/my.cnf
 
        # development machine + mysql only reachable from localhost = empty root pwd
        # secureMysql - not needed
        touch $APACHEDIR/ext/configOk.flag 
    fi
 
    echo2 Running $APACHEDIR/browserStartup.sh to start MariaDB and apache
    $APACHEDIR/browserStartup.sh
    echo2 Waiting for MariaDB to start
    sleep 5
 }
 
-# function for Debian-specific installation of mysql and apache
-function installDebian ()
+function debianInitApt ()
+# configure apt and update the APT package lists, run this before any apt-install
 {
+    # some packages, e.g. the new tzdata package asks interactive questions, suppress these
+    export DEBIAN_FRONTEND=noninteractive
+
     # update repos
     if [ ! -f /tmp/browserSetup.aptGetUpdateDone ]; then
        echo2 Running apt-get update
        apt-get update $APTERR && touch /tmp/browserSetup.aptGetUpdateDone
     fi
 
-    # the new tzdata package comes up interactive questions, suppress these
-    export DEBIAN_FRONTEND=noninteractive
+}
+
+# function for Debian-specific installation of mysql and apache
+function installDebian ()
+{
+    debianInitApt
 
     echo2 Installing ghostscript and imagemagick
     waitKey
     # ghostscript for PDF export
     # imagemagick for the session gallery
     # r-base-core for the gtex tracks
     # python-mysqldb for hgGeneGraph
-    apt-get $APTERR --no-install-recommends --assume-yes install ghostscript imagemagick wget rsync r-base-core curl gsfonts
+    apt-get $APTERR --no-install-recommends --assume-yes install ghostscript imagemagick wget rsync r-base-core curl gsfonts curl
     # python-mysqldb has been removed in almost all distros as of 2021
     # There is no need to install Python2 anymore. Remove the following?
     if apt-cache policy python-mysqldb | grep "Candidate: .none." > /dev/null; then 
 	    echo2 The package python-mysqldb is not available anymore. Working around it
 	    echo2 by installing python2 and MySQL-python with pip2
 	    if apt-cache policy python2 | grep "Candidate: .none." > /dev/null; then 
                # Ubuntu >= 21 does not have python2 anymore - hgGeneGraph has been ported, so not an issue anymore
    	       echo2 Python2 package is not available either for this distro, so not installing Python2 at all.
 	    else
                # workaround for Ubuntu 16-20 - keeping this section for a few years, just in case
                apt-get install $APTERR --assume-yes python2 libmariadb-dev python2-dev wget gcc
     	       curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output /tmp/get-pip.py
     	       python2 /tmp/get-pip.py
                if [ -f /usr/include/mysql/my_config.h ]; then
                    echo my_config.h found
@@ -1478,30 +1486,31 @@
    if grep -qv XBitHack /etc/apache2/httpd.conf ; then
      sudo sed -Ei '' '/Options FollowSymLinks Includes Multiviews/ a\
 XBitHack on\
 SSILegacyExprParser on
 ' /etc/apache2/httpd.conf
    fi
    sudo /usr/sbin/apachectl restart
 }
 
 # install gcc, make etc so we can build the tree on linux
 function setupBuildLinux ()
 {
    echo2 Installing required linux packages from repositories: Git, GCC, G++, MariaDB-client-libs, uuid, etc
    waitKey
    if [[ "$DIST" == "debian" ]]; then
+      debianInitApt
       apt-get --assume-yes $APTERR install make git gcc g++ libpng-dev libmariadb-dev uuid-dev libfreetype-dev libbz2-dev pkg-config
    elif [[ "$DIST" == "redhat" ]]; then
       yum install -y git vim gcc gcc-c++ make libpng-devel libuuid-devel freetype-devel
    else 
       echo Error: Cannot identify linux distribution
       exit 100
    fi
    # the build target cgi-bin requires that these directories exist
    mkdir -p $HTDOCDIR $CGIBINDIR
    # leave a flag file so the script knows later that this directory did not exist and we made it
    # and it is safe to write into it
    touch "$APACHEDIR"/.madeByBrowserBuild
 }
 
 # set this machine for browser development: install required tools, clone the tree, build it
@@ -1586,31 +1595,34 @@
 
     if [[ "${SET_MYSQL_ROOT}" == "1" ]]; then
        mysqlChangeRootPwd
     fi
 
     # Ideally, setup modern R fonts like at UCSC:
     # Rscript -e "install.packages(c('showtext', 'curl'), repos='http://cran.us.r-project.org')
 
     # before we do anything else with mysql
     # we need to check if we can access it. 
     # so test if we can connect to the mysql server
     checkCanConnectMysql
 
     disableSelinux
 
-    checkDownloadUdr
+    # May 2025: our udr binaries do not seem to work on some recent distros anymore (ubuntu22+24). Segfault at start.
+    # For now, switching off udr downloads. When you change this, also add back the -u flag documentation
+    # in the HELP_STR. Uncomment the following line to reactivate udr support.
+    # checkDownloadUdr
 
     # CGI DOWNLOAD AND HGCENTRAL MYSQL DB SETUP
 
     if [ ! -f $COMPLETEFLAG ]; then
         # test if an apache file is already present
         if [ -f "$APACHEDIR" ]; then
             echo2 error: please remove the file $APACHEDIR, then restart the script with "bash $0".
             exit 100
         fi
     fi
 
     # check if /usr/local/apache is empty
     # on OSX, we had to create an empty htdocs, so skip this check there
     if [ -d "$APACHEDIR" ] ; then
         if [ -f "$APACHEDIR"/.madeByBrowserBuild ] ; then