home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # @(#) preinstall.shinc 12.8 97/12/03
- #
- # 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"
-
- # dolicense return codes
- DOLICENSE_MSGS="dolicense.msgs"
- DOLICENSE_COVERED=0; DOLICENSE_ADDED_EVAL=1
- DOLICENSE_NOT_LICENSED=2; DOLICENSE_FAIL=3
-
-
- #############################################################################
- #
- # stop_servers
- #
- # stops all Web servers
- #
- #############################################################################
- stop_servers()
- {
- if [ -x /usr/sbin/nsfast ] ; then
- /usr/sbin/nsfast stop
- fi
- }
-
-
- #############################################################################
- #
- # main
- #
- #############################################################################
-
- # try to shut down any currently running servers
- stop_servers
-
- # 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/$DOLICENSE_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
-
- # check for an admin server, and warn if it isn't there
- if [ -f $INSTALL_DIR/noadminwarn.sh ]; then
- # silent installation - interaction not OK
- sh $INSTALL_DIR/noadminwarn.sh -q $MENU_DIR
- 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/dolicense.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 dolicense completely silently, with eval
- sh $INSTALL_DIR/dolicense.sh -q -e $INSTALL_DIR/l_info \
- $MENU_DIR
- dolicense_return=$?
- else
- # run dolicense completely silently
- sh $INSTALL_DIR/dolicense.sh -q $INSTALL_DIR/l_info \
- $MENU_DIR
- dolicense_return=$?
- fi
-
- # now if in initial system load, we want to log what
- # dolicense did into the log files
- if [ -f "$ISL_FILE" ]; then
- case $dolicense_return in
- ${DOLICENSE_COVERED})
- continue
- ;;
- ${DOLICENSE_ADDED_EVAL})
- echo "${PKG}\t${NAME}" >>$EVAL_LOGFILE \
- 2>/dev/null
- ;;
- ${DOLICENSE_NOT_LICENSED})
- echo "${PKG}\t${NAME}" >>$NOLIC_LOGFILE \
- 2>/dev/null
- ;;
- ${DOLICENSE_FAIL})
- echo "$ME: dolicense.sh script failed" >&2
- ;;
- esac
- fi
- else
- echo "$ME: unable to find $INSTALL_DIR/dolicense.sh" >&2
- exit $FAIL
- fi
- fi
-
- # done
- exit $SUCCESS
-