home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # @(#) preinstall.shinc 12.2 97/11/04
- #
- # Copyright (c) 1997 The Santa Cruz Operation, Inc.. All Rights Reserved.
- # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE SANTA CRUZ OPERATION INC.
- # The copyright notice above does not evidence any actual or intended
- # publication of such source code.
- #
- ME="`basename $0`"
- ISL_FILE="/etc/inst/scripts/postreboot.sh"
- SUCCESS=0; FAIL=1; INTR=3
- trap "exit $INTR" 2 3 15
- [ -f $ISL_FILE ] && exec 1>>/var/adm/log/$PKGINST.out
- [ -f $ISL_FILE ] && exec 2>>/var/adm/log/$PKGINST.err
- EVAL_LOGFILE="/var/adm/log/eval"
- NOLIC_LOGFILE="/var/adm/log/nolic"
-
- # location of the packaging information files during this phase of installation
- INSTALL_DIR="$REQDIR/$PKGINST"
-
- # eclicense return codes
- ECLICENSE_MSGS="eclicense.msgs"
- ECLICENSE_COVERED=0; ECLICENSE_ADDED_EVAL=1
- ECLICENSE_NOT_LICENSED=2; ECLICENSE_FAIL=3
-
-
- #############################################################################
- #
- # main
- #
- #############################################################################
-
- # if not done by request, then check licensing, and add if required
- if [ "$REQUEST_CHECKED_LICENSING" = "FALSE" \
- -o -z "$REQUEST_CHECKED_LICENSING" ]; then
-
- # determine the right location for menus - try /etc/inst/locale
- # first, and if no menus there then use ones in the installation
- # set - try for local ones first, then fall back on C
- LOCALE="${LC_ALL:-${LC_MESSAGES:-${LANG:-C}}}"
- MENU_DIR="/etc/inst/locale/$LOCALE/menus/$PKGINST"
- if [ ! -f $MENU_DIR/$ECLICENSE_MSGS ]; then
- if [ ! -d $INSTALL_DIR/$LOCALE ]; then
- LOCALE="C"
- fi
- MENU_DIR=$INSTALL_DIR/$LOCALE
- fi
-
- # check the UnixWare release, and abort if it's one of the
- # incompatible ones
- if [ -f $INSTALL_DIR/releasecheck.sh ]; then
- # silent installation - interaction not OK
- sh $INSTALL_DIR/releasecheck.sh -q $MENU_DIR
- if [ $? -ne 0 ]; then
- exit $FAIL
- fi
- fi
-
- # call a routine to check for, and optionally add, licensing for
- # the product, and this time do it silently since we are either
- # in initial load, or it hasn't been done in request for some
- # other reason
- if [ -f $INSTALL_DIR/eclicense.sh ]; then
- # use the pkginfo entry to determine if we should
- # allow any eval license to be added at this point
- fc="`echo \"$ALLOW_EVAL_IF_SILENT\" | cut -c1`"
- if [ "$fc" = "Y" -o "$fc" = "y" ]; then
- # run eclicense completely silently, with eval
- sh $INSTALL_DIR/eclicense.sh -q -e $INSTALL_DIR/l_info \
- $MENU_DIR
- eclicense_return=$?
- else
- # run eclicense completely silently
- sh $INSTALL_DIR/eclicense.sh -q $INSTALL_DIR/l_info \
- $MENU_DIR
- eclicense_return=$?
- fi
-
- # now if in initial system load, we want to log what
- # eclicense did into the log files
- if [ -f "$ISL_FILE" ]; then
- case $eclicense_return in
- ${ECLICENSE_COVERED})
- continue
- ;;
- ${ECLICENSE_ADDED_EVAL})
- echo "${PKG}\t${NAME}" >>$EVAL_LOGFILE \
- 2>/dev/null
- ;;
- ${ECLICENSE_NOT_LICENSED})
- echo "${PKG}\t${NAME}" >>$NOLIC_LOGFILE \
- 2>/dev/null
- ;;
- ${ECLICENSE_FAIL})
- echo "$ME: eclicense.sh script failed" >&2
- ;;
- esac
- fi
- else
- echo "$ME: unable to find $INSTALL_DIR/eclicense.sh" >&2
- exit $FAIL
- fi
- fi
-
- # done - return fail if no license
- if [ $eclicense_return -eq ${ECLICENSE_COVERED} -o \
- $eclicense_return -eq ${ECLICENSE_ADDED_EVAL} ]; then
- exit $SUCCESS
- else
- exit $FAIL
- fi
-