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

  1. #!/bin/csh -f
  2. # Installation script for MAEstro unsupported source code.
  3. # Copyright (C) 1994 by George D. Drapeau
  4. #
  5.  
  6. set OsRelease = `uname -r`                    # What release of the operating system is this?
  7. switch ($OsRelease)
  8.   case "4.*":                            # SunOS 4.X
  9.     set RootDir = /cdrom/MAEstro/unsupported        # Set top-level directory from which to retrieve unsupported stuff
  10.   breaksw
  11.   case "5.*":                            # SunOS 5.X
  12.     set RootDir = /cdrom/unnamed_cdrom/MAEstro/unsupported    # Set top-level directory from which to retrieve unsupported stuff
  13.   breaksw
  14.   default:                            # Probably not any SunOS
  15.     set RootDir = /cdrom/MAEstro/unsupported        # Set top-level directory from which to retrieve unsupported stuff
  16.   breaksw
  17. endsw    
  18.  
  19. set DestDir = "/usr/local/MAEstro"                # Set up a default directory for the unsupported stuff
  20. set OsType = `uname -s`                        # Determine the operating system type
  21.  
  22. set MAEstroLibDir = "$RootDir"                    # Determine where to find the correct MAEstro extras
  23.  
  24. if (!(-e $MAEstroLibDir)) then
  25.         echo "Cannot find the directory $RootDir.  Please make sure"
  26.     echo "that you have mounted the CD-ROM as /cdrom (for SunOS 4.x systems)"
  27.     echo "or /cdrom/unnamed_cdrom (for Solaris 2.X systems running Volume Manager),"
  28.     echo "then try this installation script again."
  29.         exit (-1)
  30. endif
  31.  
  32. set DiskSpaceNeeded = `du -s $MAEstroLibDir | awk '{print $1}'`    # Determine disk space needed to install unsupported software
  33.  
  34. echo ""
  35. echo "The default installation directory is "
  36. echo "    $DestDir"
  37. echo ""
  38. echo "The unsupported source code requires $DiskSpaceNeeded KB of disk space."
  39. echo ""
  40. echo "Would you like to install the unsupported source code into "
  41. echo -n "'$DestDir'? [y/n] "
  42. set DestDir_ok = $<                        # Ask the installer if the default directory is okay.
  43.  
  44.  
  45. CustomInstallDirectory:                        # Here begins code to install apps in a custom directory
  46.  
  47. if ($DestDir_ok != y) then                    # The default directory is not okay, prompt for a new place
  48.     echo ""
  49.         echo "Where would you like to install the unsupported source code? "
  50.     echo "(type 'q' to quit the installation process now.)"
  51.     echo -n "--> "
  52.         set DestDir = $<
  53. endif
  54.  
  55. if ($DestDir == "q") then                    # Did the installer choose to exit without installing the software?
  56.   echo "Unsupported software was not installed."
  57.   exit (-1)                            # Yes, honor that choice and quit right now
  58. endif
  59.  
  60. if (!(-e $DestDir)) then                    # Does the specified directory exist?
  61.   echo ""
  62.   echo "The directory '$DestDir' does not exist."
  63.   echo -n "Would you like to create it? [y/n] "            # No, shall this program create such a directory?
  64.   set create = $<
  65.   if ($create == y) then                    # Yes, try to create the directory specified by the installer
  66.           echo  -n "Creating installation directory..."
  67.       mkdir $DestDir >& /dev/null                # Create the directory and set appropriate permissions
  68.       if ($status != 0) then
  69.         echo ""
  70.         echo "Could not create the directory $DestDir."
  71.         echo "Please try another directory name."
  72.         echo ""
  73.         goto CustomInstallDirectory
  74.       endif
  75.       chmod 0755 $DestDir
  76.           echo "Done."
  77.   else
  78.           echo "Please try again:"
  79.       echo ""
  80.       goto CustomInstallDirectory
  81.   endif
  82. else
  83.   echo ""
  84. endif
  85.  
  86. if (!(-e $DestDir/Source)) then                    # Does the "Source" directory exist?
  87.   mkdir $DestDir/Source >& /dev/null                # No, try to create it
  88.   if ($status != 0) then                    # Did the creation fail?
  89.     echo ""                            # Yes, report the error and exit without doing anything more
  90.     echo "Could not create the directory $DestDir/Source."
  91.     echo "Please make sure you have permission to create directories under"
  92.     echo "$DestDir then run this installation script again."
  93.     exit (-1)
  94.   endif
  95. endif
  96.  
  97.  
  98. #
  99. # Avoid problems with long df entries...
  100. #
  101. set DF_LONG = `df $DestDir | tail -1 | awk '{print $4}' | egrep % | wc -c`
  102. if ( $DF_LONG == "0" ) then 
  103.         set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $4}'`
  104. else
  105.         set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $3}'`
  106. endif
  107.  
  108. if ($FreeDiskSpace < $DiskSpaceNeeded) then            # Is there enough space to hold the MAEstro apps?
  109.   echo "Sorry, the unsupported software requires $DiskSpaceNeeded KB of free disk space"    # No, inform the installer
  110.   echo "but there are only $FreeDiskSpace KB free in '$DestDir'."
  111.   echo "Please free up disk space or install unsupported software"
  112.   echo "in a different directory, then run this installation script again."
  113.   exit (-1)                            # Exit this script without doing any installation
  114. endif
  115.  
  116.  
  117. echo ""
  118. echo -n "Installing unsupported software into '$DestDir'..."
  119.  
  120. cp -r $MAEstroLibDir/* $DestDir/Source                # Copy the unsupported software into the desired directory
  121.  
  122. echo "Done."
  123.  
  124. echo ""
  125. echo 'Installation was successful.  Enjoy\!'
  126.  
  127. exit (0)                            # Installation was successful; get outtahere.
  128.