home *** CD-ROM | disk | FTP | other *** search
/ Ultra Pack / UltraComputing Partner Applications.iso / Maestro / Scripts / installApps < prev    next >
Encoding:
Text File  |  1996-01-15  |  6.4 KB  |  181 lines

  1. #!/bin/csh -f
  2. # Installation script for MAEstro applications.
  3. # Copyright (C) 1994 by George D. Drapeau
  4. #
  5.  
  6. set OsType = `uname -s`                        # Determine the operating system type
  7.  
  8. if ($OsType != "SunOS") then                    # Is this a Sun workstation?  If not, exit now
  9.   echo "This operating system is not SunOS.  Please install from a Sun workstation."
  10.   exit (-1)
  11. endif
  12.  
  13. set OsRelease = `uname -r`                    # What release of the operating system is this?
  14. switch ($OsRelease)
  15.   case "4.*":                            # SunOS 4.X
  16.     set RootDir = /cdrom/MAEstro/Applications        # Set top-level directory from which to retrieve MAEstro software
  17.   breaksw
  18.   case "5.*":                            # SunOS 5.X
  19.     set RootDir = /cdrom/unnamed_cdrom/MAEstro/Applications    # Set top-level directory from which to retrieve MAEstro software
  20.   breaksw
  21.   default:                            # Probably not any SunOS
  22.     echo "You are using either an unknown version of SunOS or are installing"
  23.     echo "from a non-Sun workstation.  Please install from a Sun workstation"
  24.     echo "for the installation to work correctly."
  25.     exit (-1)
  26.   breaksw
  27. endsw    
  28.  
  29.  
  30. set DestDir = "/usr/local/MAEstro"                # Set up a default directory for the MAEstro applications
  31.  
  32. set OsRelease = `uname -r`                    # What release of the operating system is this?
  33. switch ($OsRelease)
  34.   case "4.*":                            # SunOS 4.X
  35.     echo "Installing MAEstro applications for SunOS 4.X."
  36.     set OsDir = "SunOS4"
  37.   breaksw
  38.   case "5.*":                            # SunOS 5.X
  39.     echo "Installing MAEstro applications for Solaris 2.X."
  40.     set OsDir = "Solaris2"
  41.   breaksw
  42.   default:                            # Probably not any SunOS
  43.     echo "You are using either an unknown version of SunOS or are installing"
  44.     echo "from a non-Sun workstation.  Please install from a Sun workstation"
  45.     echo "for the installation to work correctly."
  46.     exit (-1)
  47.   breaksw
  48. endsw    
  49.  
  50. set StrippedOrDebugDir = "stripped"                # By default, install stripped binaries to save space
  51.  
  52. if ($#argv > 0) then                        # Did the installer specify a command-line argument?
  53.   if ($argv[1] == "debug") then                    # Yes, did the installer request binaries with debugging...
  54.     set StrippedOrDebugDir = "debug"            # ...symbols?  If so, set the appropriate variable.
  55.   else
  56.     set StrippedOrDebugDir = "stripped"
  57.   endif
  58. endif
  59.  
  60. set MAEstroAppDir = "$RootDir/$OsDir/$StrippedOrDebugDir"    # Determine where to find the correct MAEstro applications
  61.  
  62. if (!(-e $MAEstroAppDir)) then
  63.         echo "Cannot find the directory $RootDir.  Please make sure"
  64.     echo "that you have mounted the CD-ROM as /cdrom, then try"
  65.     echo "this installation script again."
  66.         exit (-1)
  67. endif
  68.  
  69. set DiskSpaceNeeded = `du -s $MAEstroAppDir | awk '{print $1}'`    # Determine disk space needed to install the MAEstro apps
  70.  
  71. echo ""
  72. echo "The default installation directory is "
  73. echo "    $DestDir"
  74. echo ""
  75. echo "The MAEstro applications require $DiskSpaceNeeded KB of disk space."
  76. echo ""
  77. echo "Would you like to install the MAEstro applications into "
  78. echo -n "'$DestDir'? [y/n] "
  79. set DestDir_ok = $<                        # Ask the installer if the default directory is okay.
  80.  
  81.  
  82. CustomInstallDirectory:                        # Here begins code to install apps in a custom directory
  83.  
  84. if ($DestDir_ok != y) then                    # The default directory is not okay, prompt for a new place
  85.     echo ""
  86.         echo "Where would you like to install the MAEstro applications? "
  87.     echo "(type 'q' to quit the installation process now.)"
  88.     echo -n "--> "
  89.         set DestDir = $<
  90. endif
  91.  
  92. if ($DestDir == "q") then                    # Did the installer choose to exit without installing the software?
  93.   echo "MAEstro applications were not installed."
  94.   exit (-1)                            # Yes, honor that choice and quit right now
  95. endif
  96.  
  97. if (!(-e $DestDir)) then                    # Does the specified directory exist?
  98.   echo ""
  99.   echo "The directory '$DestDir' does not exist."
  100.   echo -n "Would you like to create it? [y/n] "            # No, shall this program create such a directory?
  101.   set create = $<
  102.   if ($create == y) then                    # Yes, try to create the directory specified by the installer
  103.           echo  -n "Creating installation directory..."
  104.       mkdir $DestDir >& /dev/null                # Create the directory and set appropriate permissions
  105.       if ($status != 0) then
  106.         echo ""
  107.         echo "Could not create the directory $DestDir."
  108.         echo "Please try another directory name."
  109.         echo ""
  110.         goto CustomInstallDirectory
  111.       endif
  112.       chmod 0755 $DestDir
  113.           echo "Done."
  114.   else
  115.           echo "Please try again:"
  116.       echo ""
  117.       goto CustomInstallDirectory
  118.   endif
  119. else
  120.   echo ""
  121. endif
  122.  
  123.  
  124. if (!(-e $DestDir/bin)) then                    # Does the "bin" directory exist?
  125.   mkdir $DestDir/bin >& /dev/null                # No, try to create it
  126.   if ($status != 0) then                    # Did the creation fail?
  127.     echo ""                            # Yes, report the error and exit without doing anything more
  128.     echo "Could not create the directory $DestDir/bin."
  129.     echo "Please make sure you have permission to create directories under"
  130.     echo "$DestDir then run this installation script again."
  131.     exit (-1)
  132.   endif
  133. endif
  134.  
  135. #
  136. # Avoid problems with long df entries...
  137. #
  138. set DF_LONG = `df $DestDir | tail -1 | awk '{print $4}' | egrep % | wc -c`
  139. if ( $DF_LONG == "0" ) then 
  140.         set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $4}'`
  141. else
  142.         set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $3}'`
  143. endif
  144.  
  145. if ($FreeDiskSpace < $DiskSpaceNeeded) then            # Is there enough space to hold the MAEstro apps?
  146.   echo "Sorry, the MAEstro applications require $DiskSpaceNeeded KB of free disk space"    # No, inform the installer
  147.   echo "but there are only $FreeDiskSpace KB free in '$DestDir'."
  148.   echo "Please free up disk space or install MAEstro applications"
  149.   echo "in a different directory, then run this installation script again."
  150.   exit (-1)                            # Exit this script without doing any installation
  151. endif
  152.  
  153.  
  154. echo ""
  155. echo "Installing MAEstro applications into the directory '$DestDir/bin'..."
  156.  
  157. pushd $MAEstroAppDir >& /dev/null                # Go to the directory where the MAEstro apps reside
  158. foreach i (*)                            # Install each app individually, reporting status on each
  159.   echo -n "    $i..."
  160.   cp $i $DestDir/bin                        # Copy this application into the desired directory
  161.   echo "Installed."
  162. end
  163. popd >& /dev/null
  164.  
  165. pushd $DestDir/bin >& /dev/null
  166. ln -s MaMA-30 MaMA >& /dev/null                    # Use the FrameMaker 3.X version of MaMA
  167. popd >& /dev/null
  168.  
  169.  
  170. echo ""
  171. echo "Installation was successful."
  172. echo ""
  173. echo "To use the MAEstro applications, make sure your PATH environment variable"
  174. echo "includes the directory '$DestDir/bin'."
  175. echo ""
  176. echo "For example, put the following line at the end of your .cshrc file:"
  177. echo "    set path=($DestDir/bin" '$path)'
  178. echo ""
  179.  
  180. exit (0)                            # Installation was successful; get outtahere.
  181.