#!/bin/sh # file: install.unx G. Moody 3 February 1995 # Last revised: 7 May 1997 # Install UNIX binaries of DB Software Package and WAVE for supported systems # # Copyright(C) Massachusetts Institute of Technology 1997. All rights reserved. # # This program must be run from the directory that contains the `tar' archives # (probably /cdrom/software). You will need root permissions to run the `ln' # commands below and `ldconfig', and you may also need root permissions to # write into /usr/local. # # If this program is interrupted before installation is complete, simply run # it again to finish the installation. If you wish to remove the files # installed by this program, run `uninst.unx' (also in this directory). # First, this script identifies the CPU and the operating system, and chooses # a set of binaries to install. Future versions may include more sets of # binaries ... contributions, anyone? ARCHIVE=bogus CPU=`uname -m` case $CPU in sun4*) OSREL=`uname -r` case $OSREL in 4.1*) ARCHIVE=sunos.tar; OS=SunOS; LDCONFIG=/usr/etc/ldconfig ;; 5.*) ARCHIVE=solaris.tar; OS=Solaris; LDCONFIG=bogus ;; esac ;; i*86) OS=`uname -s` case $OS in Linux) LDCONFIG=/sbin/ldconfig if ( file `which gcc` | grep -q ELF ) then ARCHIVE=linux.tar else ARCHIVE=linuxold.tar fi ;; esac ;; esac case $ARCHIVE in bogus) echo Sorry, precompiled binaries are not available for your system. echo Please see db/makefile.unx for information on compiling the echo DB Software Package from the sources included on this CD-ROM. exit 1 ;; esac S=`pwd` cd /usr/local # Determine the version number for the binaries to be installed from this CD. tar xf $S/$ARCHIVE dbswpver.dat if [ -s /usr/local/dbswpver.dat ]; then CDVMAJOR=`grep Version dbswpver.dat | cut -f6 "-d " | cut -f1 -d.` CDVMINOR=`grep Version dbswpver.dat | cut -f6 "-d " | cut -f2 -d.` else echo Be sure that you have write permission in /usr/local, then try again. exit 1 fi # Determine the version number for the version previously installed. HDVMAJOR=0 HDVMINOR=0 if [ -s /usr/local/.dbswpver.dat ] then HDVMAJOR=`grep Version .dbswpver.dat | cut -f6 "-d " | cut -f1 -d.` HDVMINOR=`grep Version .dbswpver.dat | cut -f6 "-d " | cut -f2 -d.` fi # If the same or a later version has already been installed, ask for # confirmation before overwriting it. INSTALL=yes if [ $HDVMAJOR -gt $CDVMAJOR ] then INSTALL=no else if [ $HDVMAJOR -eq $CDVMAJOR ] then if [ $HDVMINOR -gt $CDVMINOR ] then INSTALL=no else if [ $HDVMINOR -eq $CDVMINOR ] then INSTALL=maybe fi fi fi fi case $INSTALL in no) echo "Version $HDVMAJOR.$HDVMINOR of the MIT DB Software Package appears to have been installed on" echo "this system already. This CD-ROM contains version $CDVMAJOR.$CDVMINOR, an earlier version." echo echo -n "Do you really want to install the earlier version? [y/n]: n" read INSTALL ;; maybe) echo "Version $HDVMAJOR.$HDVMINOR of the MIT DB Software Package appears to have been installed on" echo "this system already." echo echo -n "Do you wish to reinstall this version from the CD-ROM? [y/n]: n" read INSTALL ;; esac case $INSTALL in y*|Y*) echo Installing files into /usr/local ... ;; *) exit 1 ;; esac # Unpack the portable files into /usr/local/{database,help,include,man}. Do # this first in case one of the binary distributions needs a customized version # of one of these files. tar xfv $S/common.tar # Unpack the binaries into /usr/local/bin and /usr/local/lib. tar xfv $S/$ARCHIVE # For Linux, additional setup for WAVE may be required. For Linux without ELF # support, select the `a.out' format binary that matches the X server. The # `a.out' binaries are statically linked to the XView libraries. # # For Linux with ELF support, this program installs an ELF format binary that # is dynamically linked to the XView and X11R6 libraries. The X11R6 libraries # should be available with any version of Linux that supports ELF. If the # shared XView libraries (libxview.so.3.* and libolgx.so.3.*) are missing, # this program installs them from the copies in `linuxmsc'. Note that # `uninst.unx' does not remove these libraries.) case $ARCHIVE in linuxold.tar) XREL=`grep XlibSpecificationRelease /usr/include/X11/Xlib.h | cut -f 3 "-d "` case $XREL in 6) ln -s /usr/local/bin/wave.r6 /usr/local/bin/wave ;; *) ln -s /usr/local/bin/wave.r5 /usr/local/bin/wave ;; esac ;; linux.tar) ldd /usr/local/bin/wave | grep -q "libxview.so.3 => not found" && \ ( cd $S/linuxmsc; cp -p libolgx.so.3.2.0 libxview.so.3.2.0 /usr/local/lib; \ cd /usr/lib; ln -s /usr/local/lib/libolgx* /usr/local/lib/libxview* . ; echo "Installed missing XView libraries libolgx.so.3.2.0 and" ; echo "libxview.so.3.2.0 in /usr/local/lib, and symbolic links to these" echo "in /usr/lib. Sources for these libraries are in $S/xview32.tgz," echo "with patches for Linux in $S/linuxmsc/xv32pat.tgz." ) ;; esac # Save the version number data for next time. mv /usr/local/dbswpver.dat /usr/local/.dbswpver.dat # Make the DB library include files accessible without needing a `-I' option. ln -s /usr/local/include/ecg /usr/include # Make the DB libraries accessible without needing a `-L' option. ln -s /usr/local/lib/libdb.* /usr/lib # Reconfigure ld.so so that the DB shared library can be found. case $OS in Linux|SunOS) if [ -x $LDCONFIG ] then $LDCONFIG else echo "Warning: $LDCONFIG could not be executed. Find ldconfig" echo "and run it before attempting to run the DB applications." echo fi ;; Solaris) rm -f /usr/lib/libdb.so ln -s /usr/local/lib/libdb.so.$CDVMAJOR /usr/lib/libdb.so ;; esac # Make the HTML files on this disk accessible from WAVE (they need to appear # to be in /usr/local/help/html). ln -s $S/../html /usr/local/help echo "Checking libraries needed by WAVE ..." if ( ldd /usr/local/bin/wave | grep "not found") then echo "One or more libraries appear to be missing, as shown above." echo "Make a note of the names of the missing libraries now, then" echo -n "press Enter to continue: " read A echo "When this script finishes, look for the missing libraries in" echo "/usr/openwin/lib and in /usr/local/lib. If you find them, do" echo "ONE of the following:" echo " * Add the directories in which the missing libraries were found" echo " to each user's LD_LIBRARY_PATH. For example, a C-shell user" echo " can add /usr/openwin/lib to LD_LIBRARY_PATH by:" echo " setenv LD_LIBRARY_PATH /usr/openwin/lib:\$LD_LIBRARY_PATH" echo " * Alternatively, make symbolic links from the libraries you have" echo " found to /usr/lib. For example:" echo " ln -s /usr/openwin/lib/libxview.so* /usr/lib" echo " ln -s /usr/openwin/lib/libolgx.so* /usr/lib" case $LDCONFIG in bogus) ;; *) echo " After you have made any necessary links, type:" echo " $LDCONFIG" echo " to refresh the dynamic link editor cache." ;; esac echo "Check for missing libraries again using the command:" echo " ldd /usr/local/bin/wave" echo "If you are unable to locate one or more libraries, see the WAVE" echo "User's Guide for information on how to obtain them." echo echo -n "Press Enter to continue: " read A fi echo "The DB Software Package and WAVE have been installed. The programs may" echo "be found in /usr/local/bin, which should be in your PATH. Before using" echo "this software, you must set the environment variable DB (the database" echo "path). Do this by typing" echo " source /usr/local/bin/cshsetdb" echo "(if you use the C-shell), or" echo " . setdb" echo "(if you use bash or the Bourne or Korn shell). It will be easiest to" echo "put one of these commands into each user's .cshrc or .profile." echo "See the ECG Database Programmer's Guide for details." echo echo "Add /usr/local/man to your MANPATH in order to be able to use 'man'" echo "to read the on-line documentation."