home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls008.1.Z / tls008.1 / tmp / perms / prep.demo < prev   
Encoding:
Text File  |  1991-04-06  |  1.8 KB  |  94 lines

  1. :
  2. #
  3. #    prep.demo - Corollary Multiprocessor Demo Software
  4. #            custom installation preparation script
  5. #
  6. #    Copyright (C) Corollary, Inc., 1986, 1987, 1988, 1989, 1990, 1991.
  7. #    All Rights Reserved.
  8. #    This Module contains Proprietary Information of
  9. #    Corollary, Inc., and should be treated as Confidential.
  10. #
  11.  
  12. # Define return values
  13. : ${OK=0} ${FAIL=1} ${STOP=10} ${HALT=11}
  14.  
  15. PRODUCT="Corollary Multiprocessor Demo"
  16.  
  17. trap 'cleanup 1' 1 2 3 15
  18.  
  19. cleanup()
  20. {
  21.     trap '' 1 2 3 15
  22.     rm -f /tmp/perms/prep.demo
  23.     exit $1
  24. }
  25.  
  26. getrel()
  27. {
  28.     instperm=/etc/perms/inst
  29.  
  30.     release=`sed -n 's/^#rel=\(.*\)$/\1/p' $instperm`
  31.     ver=`echo $release | sed 's/\(.*\).$/\1/'`
  32.     OSVER=$ver
  33. }
  34.  
  35. # testpkg()
  36. # Usage : testpkg pkg descr perm
  37. # Test to see if a package is installed and prompt to install it if not.
  38. # Dependencies: custom
  39. # Notes: Return 1 if package cannot be installed.
  40. #     Assumes that the current directory is appropriate for fixperm to work.
  41. #     The function requires the following parameters
  42. #        The package name in upper case
  43. #        A description of the package
  44. #        The permlist to be used (optional, uses $prdperm if no permlist
  45. #            is passed)
  46. #
  47. testpkg()
  48.     fixperm=fixperm
  49.     for _i in /etc ./tmp
  50.     do    
  51.         [ -x $_i/fixperm ] && fixperm=$_i/fixperm
  52.     done
  53.     _pkg=$1 _descr=$2 _perm=${3:-${prdperm?}}
  54.     until ${fixperm?} -i -d$_pkg ${_perm?} > /dev/null 2>&1
  55.     do
  56.         case $? in
  57.             0)    return 0      ;;
  58.             *)    return 1      ;;
  59.             esac
  60.     done
  61.     unset _descr _pkg
  62.     return 0
  63. }
  64.  
  65. # Test to see if SCO MPX is installed 
  66. # Calls function testpkg.
  67. testmpx()
  68.     _currdir=`pwd`
  69.  
  70.     cd /
  71.     if testpkg "MPX" "SCO MPX" "/etc/perms/mpx"
  72.     then
  73.         cd $_currdir
  74.         return $OK
  75.     else
  76.         echo "
  77. You cannot install $PRODUCT without fully installing
  78. the SCO MPX package."
  79.         echo "\nPress <Return> to continue\c"
  80.         read dontcare
  81.         cd $_currdir
  82.         return $FAIL
  83.     fi
  84. }
  85.  
  86.  
  87. # main()
  88.  
  89. cd /
  90. testmpx
  91. cleanup $OK
  92.