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

  1. #!/bin/sh
  2. #
  3. #    @(#) preinstall.shinc 12.2 97/11/04 
  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. # eclicense return codes
  23. ECLICENSE_MSGS="eclicense.msgs"
  24. ECLICENSE_COVERED=0; ECLICENSE_ADDED_EVAL=1
  25. ECLICENSE_NOT_LICENSED=2; ECLICENSE_FAIL=3
  26.  
  27.  
  28. #############################################################################
  29. #
  30. # main
  31. #
  32. #############################################################################
  33.  
  34. # if not done by request, then check licensing, and add if required
  35. if [ "$REQUEST_CHECKED_LICENSING" = "FALSE" \
  36.             -o -z "$REQUEST_CHECKED_LICENSING" ]; then
  37.  
  38.     # determine the right location for menus - try /etc/inst/locale
  39.     # first, and if no menus there then use ones in the installation
  40.     # set - try for local ones first, then fall back on C
  41.     LOCALE="${LC_ALL:-${LC_MESSAGES:-${LANG:-C}}}"
  42.     MENU_DIR="/etc/inst/locale/$LOCALE/menus/$PKGINST"
  43.     if [ ! -f $MENU_DIR/$ECLICENSE_MSGS ]; then
  44.         if [ ! -d $INSTALL_DIR/$LOCALE ]; then
  45.             LOCALE="C"
  46.         fi
  47.         MENU_DIR=$INSTALL_DIR/$LOCALE
  48.     fi
  49.  
  50.     # check the UnixWare release, and abort if it's one of the
  51.     # incompatible ones
  52.     if [ -f $INSTALL_DIR/releasecheck.sh ]; then
  53.         # silent installation - interaction not OK
  54.         sh $INSTALL_DIR/releasecheck.sh -q $MENU_DIR
  55.         if [ $? -ne 0 ]; then
  56.             exit $FAIL
  57.         fi
  58.     fi
  59.  
  60.     # call a routine to check for, and optionally add, licensing for
  61.     # the product, and this time do it silently since we are either
  62.     # in initial load, or it hasn't been done in request for some
  63.     # other reason
  64.     if [ -f $INSTALL_DIR/eclicense.sh ]; then
  65.         # use the pkginfo entry to determine if we should
  66.         # allow any eval license to be added at this point
  67.         fc="`echo \"$ALLOW_EVAL_IF_SILENT\" | cut -c1`"
  68.         if [ "$fc" = "Y" -o "$fc" = "y" ]; then
  69.             # run eclicense completely silently, with eval
  70.             sh $INSTALL_DIR/eclicense.sh -q -e $INSTALL_DIR/l_info \
  71.                     $MENU_DIR
  72.             eclicense_return=$?
  73.         else
  74.             # run eclicense completely silently
  75.             sh $INSTALL_DIR/eclicense.sh -q $INSTALL_DIR/l_info \
  76.                     $MENU_DIR
  77.             eclicense_return=$?
  78.         fi
  79.  
  80.         # now if in initial system load, we want to log what
  81.         # eclicense did into the log files
  82.         if [ -f "$ISL_FILE" ]; then
  83.             case $eclicense_return in
  84.             ${ECLICENSE_COVERED})
  85.                 continue
  86.                 ;;
  87.             ${ECLICENSE_ADDED_EVAL})
  88.                 echo "${PKG}\t${NAME}" >>$EVAL_LOGFILE \
  89.                         2>/dev/null
  90.                 ;;
  91.             ${ECLICENSE_NOT_LICENSED})
  92.                 echo "${PKG}\t${NAME}" >>$NOLIC_LOGFILE \
  93.                         2>/dev/null
  94.                 ;;
  95.             ${ECLICENSE_FAIL})
  96.                 echo "$ME: eclicense.sh script failed" >&2
  97.                 ;;
  98.             esac
  99.         fi
  100.     else
  101.         echo "$ME: unable to find $INSTALL_DIR/eclicense.sh" >&2
  102.         exit $FAIL
  103.     fi
  104. fi
  105.  
  106. # done - return fail if no license
  107. if [ $eclicense_return -eq ${ECLICENSE_COVERED} -o \
  108.         $eclicense_return -eq ${ECLICENSE_ADDED_EVAL} ]; then
  109.     exit $SUCCESS
  110. else
  111.     exit $FAIL
  112. fi
  113.