home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nsfast / install / preinstall < prev    next >
Text File  |  1998-08-19  |  4KB  |  132 lines

  1. #!/bin/sh
  2. #
  3. #    @(#) preinstall.shinc 12.8 97/12/03 
  4. #
  5. # Copyright (c) 1997 The Santa Cruz Operation, Inc.. All Rights Reserved.
  6. # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE SANTA CRUZ OPERATION INC.
  7. # The copyright notice above does not evidence any actual or intended
  8. # publication of such source code.
  9. #
  10. ME="`basename $0`"
  11. ISL_FILE="/etc/inst/scripts/postreboot.sh"
  12. SUCCESS=0; FAIL=1; INTR=3
  13. trap "exit $INTR" 2 3 15
  14. [ -f $ISL_FILE ] && exec 1>>/var/adm/log/$PKGINST.out
  15. [ -f $ISL_FILE ] && exec 2>>/var/adm/log/$PKGINST.err
  16. EVAL_LOGFILE="/var/adm/log/eval"
  17. NOLIC_LOGFILE="/var/adm/log/nolic"
  18.  
  19. # location of the packaging information files during this phase of installation
  20. INSTALL_DIR="$REQDIR/$PKGINST"
  21.  
  22. # dolicense return codes
  23. DOLICENSE_MSGS="dolicense.msgs"
  24. DOLICENSE_COVERED=0; DOLICENSE_ADDED_EVAL=1
  25. DOLICENSE_NOT_LICENSED=2; DOLICENSE_FAIL=3
  26.  
  27.  
  28. #############################################################################
  29. #
  30. # stop_servers
  31. #
  32. # stops all Web servers
  33. #
  34. #############################################################################
  35. stop_servers()
  36. {
  37.     if [ -x /usr/sbin/nsfast ] ; then
  38.         /usr/sbin/nsfast stop
  39.     fi
  40. }
  41.  
  42.  
  43. #############################################################################
  44. #
  45. # main
  46. #
  47. #############################################################################
  48.  
  49. # try to shut down any currently running servers
  50. stop_servers
  51.  
  52. # if not done by request, then check licensing, and add if required
  53. if [ "$REQUEST_CHECKED_LICENSING" = "FALSE" \
  54.             -o -z "$REQUEST_CHECKED_LICENSING" ]; then
  55.  
  56.     # determine the right location for menus - try /etc/inst/locale
  57.     # first, and if no menus there then use ones in the installation
  58.     # set - try for local ones first, then fall back on C
  59.     LOCALE="${LC_ALL:-${LC_MESSAGES:-${LANG:-C}}}"
  60.     MENU_DIR="/etc/inst/locale/$LOCALE/menus/$PKGINST"
  61.     if [ ! -f $MENU_DIR/$DOLICENSE_MSGS ]; then
  62.         if [ ! -d $INSTALL_DIR/$LOCALE ]; then
  63.             LOCALE="C"
  64.         fi
  65.         MENU_DIR=$INSTALL_DIR/$LOCALE
  66.     fi
  67.  
  68.     # check the UnixWare release, and abort if it's one of the
  69.     # incompatible ones
  70.     if [ -f $INSTALL_DIR/releasecheck.sh ]; then
  71.         # silent installation - interaction not OK
  72.         sh $INSTALL_DIR/releasecheck.sh -q $MENU_DIR
  73.         if [ $? -ne 0 ]; then
  74.             exit $FAIL
  75.         fi
  76.     fi
  77.  
  78.     # check for an admin server, and warn if it isn't there
  79.     if [ -f $INSTALL_DIR/noadminwarn.sh ]; then
  80.         # silent installation - interaction not OK
  81.         sh $INSTALL_DIR/noadminwarn.sh -q $MENU_DIR
  82.     fi
  83.  
  84.     # call a routine to check for, and optionally add, licensing for
  85.     # the product, and this time do it silently since we are either
  86.     # in initial load, or it hasn't been done in request for some
  87.     # other reason
  88.     if [ -f $INSTALL_DIR/dolicense.sh ]; then
  89.         # use the pkginfo entry to determine if we should
  90.         # allow any eval license to be added at this point
  91.         fc="`echo \"$ALLOW_EVAL_IF_SILENT\" | cut -c1`"
  92.         if [ "$fc" = "Y" -o "$fc" = "y" ]; then
  93.             # run dolicense completely silently, with eval
  94.             sh $INSTALL_DIR/dolicense.sh -q -e $INSTALL_DIR/l_info \
  95.                     $MENU_DIR
  96.             dolicense_return=$?
  97.         else
  98.             # run dolicense completely silently
  99.             sh $INSTALL_DIR/dolicense.sh -q $INSTALL_DIR/l_info \
  100.                     $MENU_DIR
  101.             dolicense_return=$?
  102.         fi
  103.  
  104.         # now if in initial system load, we want to log what
  105.         # dolicense did into the log files
  106.         if [ -f "$ISL_FILE" ]; then
  107.             case $dolicense_return in
  108.             ${DOLICENSE_COVERED})
  109.                 continue
  110.                 ;;
  111.             ${DOLICENSE_ADDED_EVAL})
  112.                 echo "${PKG}\t${NAME}" >>$EVAL_LOGFILE \
  113.                         2>/dev/null
  114.                 ;;
  115.             ${DOLICENSE_NOT_LICENSED})
  116.                 echo "${PKG}\t${NAME}" >>$NOLIC_LOGFILE \
  117.                         2>/dev/null
  118.                 ;;
  119.             ${DOLICENSE_FAIL})
  120.                 echo "$ME: dolicense.sh script failed" >&2
  121.                 ;;
  122.             esac
  123.         fi
  124.     else
  125.         echo "$ME: unable to find $INSTALL_DIR/dolicense.sh" >&2
  126.         exit $FAIL
  127.     fi
  128. fi
  129.  
  130. # done
  131. exit $SUCCESS
  132.