#! /bin/sh # Shell script for installing Geomview binary distribution cpu=sgi dir=`expr "$0" : "\(.*\)/[^/]*"` if [ "$dir" != "" ] ; then cd $dir ; fi if [ -r ./mathematica/OOGL.m ] ; then havemma="yes" else havemma="no" fi case "$cpu" in "next") # If possible, get default notion of geomroot from ./geomrootpath, # which is created by NeXT Installer (script Geomview.post_install) # and contains the pathname specified by the person who installed # Geomview.app. This is because that pathname may be more canonial # that what /bin/pwd returns. if [ -f "./geomrootpath" ] ; then geomroot=`head -1 geomrootpath` ; else geomroot=`/bin/pwd` fi bindir=/usr/local/bin mandir=/usr/man mmadir= ;; "sgi"|*) geomroot=`/bin/pwd` bindir=/usr/local/bin mandir=/usr/catman/local mmadir= ;; esac ######################################################################## noop() { : } abort() { trap noop 1 2 3 13 15 ; echo "" ; echo "Installation aborted." ; echo "" ; exit 1 ; } trap abort 1 2 3 13 15 ######################################################################## checkdir() { dir=$1 if [ -d "$dir" -a ! -w "$dir" ] ; then echo ' You do not have permission to write to directory '$dir'. Please run the "install" script again and specify a directory that you can write to. ' ; abort ; fi } echo ' This is the installation script for the binary distribution of Geomview. Hit control-C at any time to abort the installation. You will be asked to specify several directories into which various components of Geomview will be installed. For each directory, enter the pathname on a line by itself with no spaces before or after it.' if [ "$dir" != "" ] ; then echo 'This script is running in the directory '$dir' All relative pathnames you enter will be relative to this directory.' fi ######################################################################## case "$cpu" in "next") echo ' 1. Specify the *absolute* pathname of the installed Geomview root directory; this is the directory called "Geomview.app". Geomview needs to know where this directory is in order to run. If you move this directory you will have to re-run this install script in order for Geomview to work. Be sure to specify an absolute pathname! Enter the directory on the next line, or hit without typing anything to use '$geomroot':' ;; "sgi"|*) echo ' 1. Specify the *absolute* pathname of the installed Geomview root directory; this is the directory called "Geomview" that was created when you unpacked the Geomview distribution. Geomview needs to know where this directory is in order to run. If you move this directory you will have to re-run this install script in order for Geomview to work. Be sure to specify an absolute pathname! Enter the directory on the next line, or hit without typing anything to use '$geomroot':' ;; esac read input if [ "$input" != "" ] ; then geomroot=$input fi if [ ! -d $geomroot ] ; then echo '' echo 'The directory '$geomroot' does not exist. Try again.' abort fi ######################################################################## echo ' 2. There are several executable files associated with Geomview. These include a shell script called "geomview" which invokes geomview, plus several auxiliary programs. Please specify the directory where you want to install these executable files. This directory should be on user'"'"'s $path. Enter the directory on the next line, or hit without typing anything to use '$bindir':' read input if [ "$input" != "" ] ; then bindir=$input fi checkdir $bindir ######################################################################## echo ' 3. Specify the directory where you want to install the Unix manual page files. This should be a directory that is searched by the "man" command; it should have subdirectories "man1", "cat1", etc. Enter the directory on the next line, or hit without typing anything to use '$mandir':' read input if [ "$input" != "" ] ; then mandir=$input fi checkdir $mandir ######################################################################## if [ "$havemma" = "yes" ] ; then echo ' 4. Specify the directory where you want to install the Mathematica packages. If you do not have Mathematica, hit without typing anything. This should be a directory that Mathematica looks in for packages that it loads (it should be in the list of directories given by the value of Mathematica'"'"'s $Path variable). Enter the directory on the next line, or hit without typing anything if you do not want to install the Mathematica packages:' read mmadir if [ "$mmadir" != "" ] ; then checkdir $mandir fi fi ######################################################################## echo ' You have entered: Geomview root directory: '$geomroot' install executables in: '$bindir' install man pages in: '$mandir'' if [ "$havemma" = "yes" ] ; then if [ "$mmadir" != "" ] ; then echo 'install Mathematica packages in: '$mmadir'' else echo 'Mathematica packages will not be installed.' fi fi echo ' NOTE: the installation process will overwrite any existing Geomview files which are already in these directories.' if [ ! -d "$bindir" -o ! -d "$mandir" -o "$mmadir" != "" -a ! -d "$mmadir" ] ; then echo '' echo 'The following directories do not exist and will be created' echo 'during installation:' if [ ! -d "$bindir" ] ; then echo " $bindir" fi if [ ! -d "$mandir" ] ; then echo " $mandir" fi if [ "$mmadir" != "" -a ! -d "$mmadir" ] ; then echo " $mmadir" fi fi echo ' Is this correct? [Y/n] \c' read ans echo '' case "$ans" in [yY]*|"") echo '' echo 'Installing ...' ;; *) abort ;; esac make_log() { trap noop ; /bin/rm -f install.log ( echo "GEOMROOT=$geomroot" ; echo "BINDIR=$bindir" ; echo "MANDIR=$mandir" ; if [ "$mmadir" != "" ] ; then echo "MMAPACKAGEDIR=$mmadir" ; else echo '[Mathematica packages not installed.]' ; echo '' fi ) > install.log cat $$.log >> install.log /bin/rm -f $$.log } partial_abort() { trap noop 1 2 3 13 15 ; echo '' ; echo 'Installation aborted after some files were installed.' ; echo 'See the file "install.log" for a record.' ; echo '' ; make_log ; ( echo '' ; echo 'This installation was aborted before completion.' ; echo '' ; ) >> install.log exit 1 ; } trap partial_abort 1 2 3 13 15 make -k GEOMROOT="$geomroot" BINDIR="$bindir" \ MMAPACKAGEDIR="$mmadir" MANDIR="$mandir" \ install_all 2>&1 | tee $$.log if grep -i error $$.log >&- 2>&- ; then success="no" echo '' echo 'Installation not completed due to errors. Re-run the' echo 'install script after fixing the problem(s).' else success="yes" echo '' echo 'Geomview installation complete.' fi | tee -a $$.log make_log echo '' echo 'A record of this installation is in the file "install.log"' if grep -i error install.log >&- 2>&- ; then success="no" else success="yes" fi if [ "$success" != "yes" ] ; then exit 1 fi ######################################################################## reg_addr="register@geom.umn.edu" reg_file="REGISTER" do_send_msg() { echo 'Please enter the name of a contact person at your site: \c' ; read contact_name ; echo 'Please enter the e-mail address of the contact person: \c' ; read contact_addr ; echo ' Would you like to be added to the geomview-users mailing list to receive information about updates, future releases, bug fixes, and to communicate with other geomview users? [Y/n] \c' read add_to_list ; echo '' echo 'Sending mail to '$reg_addr ( case "$cpu" in "next") echo 'NeXTStep binary distribution 1.4.1 ' if [ -x /usr/bin/arch ] ; then echo "/usr/bin/arch: `/usr/bin/arch`" else echo "(apparently using NeXTStep 3.0)" fi ;; "sgi") echo 'SGI binary distribution 1.4.1 ' ;; *) echo 'Unknown binary distribution 1.4.1 ' ;; esac echo ' Contact person: '$contact_name' email: '$contact_addr' ' ; case "$add_to_list" in [yY]*|"") echo 'Please add to geomview-users list. ' ; ;; esac ; ) | Mail -s 'New Geomview Installation' $reg_addr echo '' } echo ' It is important for us to know who is using Geomview. If you do not object, an email message will be sent to '$reg_addr' mentioning this installation. If you do not wish such a message to be sent, enter "no". But please, do send the message. It is very helpful to us. Send a message? [Y/n] \c' read ans echo '' case "$ans" in [yY]*|"") do_send_msg ; ;; esac echo 'It is very useful for us to know what our users are doing with Geomview. Please read the file '$reg_file' which explains how to keep us informed. Thank you, and happy geomviewing! ' exit 0