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

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