home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / sun4beta.lha / Geomview / install < prev    next >
Encoding:
Text File  |  1993-12-14  |  9.3 KB  |  398 lines

  1. #! /bin/sh
  2.  
  3. # Shell script for installing Geomview binary distribution
  4.  
  5. cpu=sun4
  6.  
  7. dir=`expr "$0" : "\(.*\)/[^/]*"`
  8. if [ "$dir" != "" ] ; then 
  9.   cd $dir ;
  10. fi
  11.  
  12. if [ -r ./mathematica/OOGL.m ] ; then
  13.   havemma="yes"
  14. else
  15.   havemma="no"
  16. fi
  17.  
  18. case "$cpu" in
  19.   "next")
  20.     # If possible, get default notion of geomroot from ./geomrootpath,
  21.     # which is created by NeXT Installer (script Geomview.post_install)
  22.     # and contains the pathname specified by the person who installed
  23.     # Geomview.app.  This is because that pathname may be more canonial
  24.     # that what /bin/pwd returns.
  25.     if [ -f "./geomrootpath" ] ; then
  26.       geomroot=`head -1 geomrootpath` ;
  27.     else
  28.       geomroot=`/bin/pwd`
  29.     fi
  30.     bindir=/usr/local/bin
  31.     mandir=/usr/man
  32.     mmadir=
  33.     ;;
  34.   "sgi")
  35.     geomroot=`/bin/pwd`
  36.     bindir=/usr/local/bin
  37.     mandir=/usr/catman/local
  38.     mmadir=
  39.     ;;
  40.   "sun4"|*)
  41.     geomroot=`/bin/pwd`
  42.     bindir=/usr/local/bin
  43.     mandir=/usr/local/man
  44.     mmadir=
  45.     ;;
  46. esac
  47.  
  48. ########################################################################
  49.  
  50. noop() {
  51.  :
  52. }
  53.  
  54. abort() {
  55.   trap noop 1 2 3 13 15 ;
  56.   echo "" ;
  57.   echo "Installation aborted." ;
  58.   echo "" ;
  59.   exit 1 ;
  60. }
  61.  
  62. trap abort 1 2 3 13 15
  63.  
  64. ########################################################################
  65.  
  66. necho()
  67. {
  68.   case $cpu in
  69.     sun4)  echo -n "$*" ;;
  70.     *) echo "$*\c" ;;
  71.   esac
  72. }
  73.  
  74. checkdir()
  75. {
  76.   dir=$1
  77.   if [ -d "$dir" -a ! -w "$dir" ] ; then
  78.     echo '
  79. You do not have permission to write to directory '$dir'.
  80. Please run the "install" script again and specify a directory
  81. that you can write to.
  82. ' ;
  83.     abort ;
  84.   fi
  85. }
  86.  
  87. echo '
  88. This is the installation script for the binary distribution of
  89. Geomview.  Hit control-C at any time to abort the installation.
  90.  
  91. You will be asked to specify several directories into which various
  92. components of Geomview will be installed.  For each directory, enter
  93. the pathname on a line by itself with no spaces before or after it.'
  94.  
  95. if [ "$dir" != "" ] ; then 
  96.   echo 'This script is running in the directory 
  97.     '$dir'
  98. All relative pathnames you enter will be relative to this directory.'
  99. fi
  100.  
  101. ########################################################################
  102.  
  103. case "$cpu" in
  104.   "next")
  105.     echo '
  106.  
  107. 1. Specify the *absolute* pathname of the installed Geomview root
  108.    directory; this is the directory called "Geomview.app".  Geomview
  109.    needs to know where this directory is in order to run.  If you move
  110.    this directory you will have to re-run this install script in order
  111.    for Geomview to work.  Be sure to specify an absolute pathname!
  112.    Enter the directory on the next line, or hit <return> without
  113.    typing anything to use '$geomroot':'
  114.      ;;
  115.  
  116.   "sgi"|"sun4"|*)
  117.     echo '
  118.  
  119. 1. Specify the *absolute* pathname of the installed Geomview root
  120.    directory; this is the directory called "Geomview" that was created
  121.    when you unpacked the Geomview distribution.  Geomview needs to
  122.    know where this directory is in order to run.  If you move
  123.    this directory you will have to re-run this install script in order
  124.    for Geomview to work.  Be sure to specify an absolute pathname!
  125.    Enter the directory on the next line, or hit <return> without
  126.    typing anything to use '$geomroot':'
  127.      ;;
  128. esac
  129.  
  130. read input
  131. if [ "$input" != "" ] ; then
  132.   geomroot=$input
  133. fi
  134.  
  135. if [ ! -d $geomroot ] ; then
  136.   echo ''
  137.   echo 'The directory '$geomroot' does not exist.  Try again.'
  138.   abort
  139. fi
  140.  
  141. ########################################################################
  142.  
  143. echo '
  144. 2. There are several executable files associated with Geomview.  These
  145.    include a shell script called "geomview" which invokes geomview,
  146.    plus several auxiliary programs.  Please specify the directory
  147.    where you want to install these executable files.  This directory
  148.    should be on user'"'"'s $path.  Enter the directory on the next
  149.    line, or hit <return> without typing anything to use
  150.       '$bindir':'
  151.  
  152. read input
  153. if [ "$input" != "" ] ; then
  154.   bindir=$input
  155. fi
  156.  
  157. checkdir $bindir
  158.  
  159. ########################################################################
  160.  
  161. echo '
  162. 3. Specify the directory where you want to install the Unix manual
  163.    page files.  This should be a directory that is searched by the
  164.    "man" command; it should have subdirectories "man1", "cat1", etc.
  165.    Enter the directory on the next line, or hit <return> without
  166.    typing anything to use '$mandir':'
  167.  
  168. read input
  169. if [ "$input" != "" ] ; then
  170.   mandir=$input
  171. fi
  172.  
  173. checkdir $mandir
  174.  
  175. ########################################################################
  176.  
  177. if [ "$havemma" = "yes" ] ; then
  178.  
  179. echo '
  180.  
  181. 4. Specify the directory where you want to install the Mathematica
  182.    packages.  If you do not have Mathematica, hit <return> without
  183.    typing anything.  This should be a directory that Mathematica looks
  184.    in for packages that it loads (it should be in the list of
  185.    directories given by the value of Mathematica'"'"'s $Path variable).
  186.    Enter the directory on the next line, or hit <return> without
  187.    typing anything if you do not want to install the Mathematica
  188.    packages:'
  189.  
  190. read mmadir
  191.  
  192. if [ "$mmadir" != "" ] ; then
  193.   checkdir $mandir
  194. fi
  195.  
  196. fi
  197.  
  198. ########################################################################
  199.  
  200. echo '
  201. You have entered:
  202.         Geomview root directory: '$geomroot'
  203.          install executables in: '$bindir'
  204.            install man pages in: '$mandir''
  205. if [ "$havemma" = "yes" ] ; then
  206.   if [ "$mmadir" != "" ] ; then
  207.     echo 'install Mathematica packages in: '$mmadir''
  208.   else
  209.     echo 'Mathematica packages will not be installed.'
  210.   fi
  211. fi
  212. echo '
  213. NOTE: the installation process will overwrite any existing Geomview
  214. files which are already in these directories.'
  215. if [ ! -d "$bindir" -o ! -d "$mandir" -o "$mmadir" != "" -a ! -d "$mmadir" ] ; then
  216.  
  217.   echo ''
  218.   echo 'The following directories do not exist and will be created'
  219.   echo 'during installation:'
  220.   if [ ! -d "$bindir" ] ; then
  221.     echo "  $bindir"
  222.   fi
  223.   if [ ! -d "$mandir" ] ; then
  224.     echo "  $mandir"
  225.   fi
  226.   if [ "$mmadir" != "" -a ! -d "$mmadir" ] ; then
  227.     echo "  $mmadir"
  228.   fi
  229.  
  230. fi
  231. necho '
  232. Is this correct? [Y/n] '
  233. read ans
  234. echo ''
  235. case "$ans" in
  236.   [yY]*|"")
  237.     echo ''
  238.     echo 'Installing ...'
  239.     ;;
  240.   *)
  241.     abort
  242.     ;;
  243. esac
  244.  
  245. make_log()
  246. {
  247.   trap noop ;
  248.   /bin/rm -f install.log
  249.   ( echo "GEOMROOT=$geomroot" ;
  250.     echo "BINDIR=$bindir" ;
  251.     echo "MANDIR=$mandir" ;
  252.     if [ "$mmadir" != "" ] ; then
  253.       echo "MMAPACKAGEDIR=$mmadir" ;
  254.     else
  255.       echo '[Mathematica packages not installed.]' ;
  256.     echo ''
  257.     fi ) > install.log
  258.   cat $$.log  >> install.log
  259.   /bin/rm -f $$.log
  260. }
  261.  
  262. partial_abort()
  263. {
  264.   trap noop 1 2 3 13 15 ;
  265.   echo '' ;
  266.   echo 'Installation aborted after some files were installed.' ;
  267.   echo 'See the file "install.log" for a record.' ;
  268.   echo '' ;
  269.   make_log ;
  270.   ( echo '' ;
  271.     echo 'This installation was aborted before completion.' ;
  272.     echo '' ; ) >> install.log
  273.   exit 1 ;
  274. }
  275.  
  276. trap partial_abort 1 2 3 13 15
  277.  
  278. make -k GEOMROOT="$geomroot" BINDIR="$bindir" \
  279.     MMAPACKAGEDIR="$mmadir" MANDIR="$mandir" \
  280.     install_all 2>&1 | tee $$.log
  281.  
  282. if grep -i error $$.log >&- 2>&- ; then
  283.   success="no"
  284.   echo ''
  285.   echo 'Installation not completed due to errors.  Re-run the'
  286.   echo 'install script after fixing the problem(s).'
  287. else
  288.   success="yes"
  289.   echo ''
  290.   echo 'Geomview installation complete.'
  291. fi | tee -a $$.log
  292.  
  293. make_log
  294.  
  295. echo ''
  296. echo 'A record of this installation is in the file "install.log"'
  297.  
  298. if grep -i error install.log >&- 2>&- ; then
  299.   success="no"
  300. else
  301.   success="yes"
  302. fi
  303.  
  304. if [ "$success" != "yes" ] ; then
  305.   exit 1
  306. fi
  307.  
  308. ########################################################################
  309.  
  310. reg_addr="register@geom.umn.edu"
  311. reg_file="REGISTER"
  312.  
  313. do_send_msg()
  314. {
  315.   necho 'Please enter the real life name of a contact person at your site: ' ;
  316.   read contact_name ;
  317.   necho 'Please enter the e-mail address of the contact person: ' ;
  318.   read contact_addr ;
  319.   necho '
  320. Would you like to be added to the geomview-users mailing list
  321. to receive information about updates, future releases, bug fixes,
  322. and to communicate with other geomview users? [Y/n] '
  323.   read add_to_list ;
  324.   echo ''
  325.  
  326.   echo 'Sending mail to '$reg_addr
  327. (
  328.   case "$cpu" in
  329.     "next")
  330.       echo 'NeXTStep binary distribution 1.4.1
  331. '
  332.       if [ -x /usr/bin/arch ] ; then
  333.     echo "/usr/bin/arch: `/usr/bin/arch`
  334. "
  335.       else
  336.     echo "(apparently using NeXTStep 3.0)
  337. "
  338.       fi ;
  339.       ;;
  340.     "sgi")
  341.       echo 'SGI binary distribution 1.4.1
  342. '
  343.       ;;
  344.     "sun4")
  345.       echo 'Sun4 binary distribution 1.4.1 beta
  346. '
  347.       ;;
  348.     *)
  349.       echo 'Unknown binary distribution 1.4.1
  350. '
  351.       ;;
  352.   esac
  353.     echo 'Contact person: '$contact_name'
  354.          email: '$contact_addr'
  355. ' ; 
  356.  
  357.     case "$add_to_list" in
  358.       [yY]*|"")
  359.         echo 'Please add to geomview-users list.
  360. ' ;
  361.         ;;
  362.     esac ;
  363.   case "$cpu" in
  364.     "next") hostinfo  ;;
  365.     "sgi")  uname -a ; echo ''; hinv ;;
  366.     "sun4") uname -a ;;
  367.     *) ;;
  368.   esac
  369.  
  370.   ) | Mail -s 'New Geomview Installation' $reg_addr
  371.   echo ''
  372. }
  373.  
  374. necho '
  375. It is important for us to know who is using Geomview.
  376.  
  377. If you do not object, an email message will be sent to
  378. '$reg_addr' mentioning this installation.
  379. If you do not wish such a message to be sent, enter "no".
  380. But please, do send the message.  It is very helpful to us.
  381.  
  382. Send a message? [Y/n] '
  383.  
  384. read ans
  385. echo ''
  386. case "$ans" in
  387.   [yY]*|"")
  388.     do_send_msg ;
  389.     ;;
  390. esac
  391.  
  392. echo 'It is very useful for us to know what our users are doing with
  393. Geomview.  Please read the file '$reg_file' which explains
  394. how to keep us informed.  Thank you, and happy geomviewing!
  395. '
  396.  
  397. exit 0
  398.