#!/sbin/sh
########
# Product: UserLicense
# Fileset: *-USER
# checkinstall
# @(#) $Revision: 1.4.98.1 $
# $Date: 95/07/20 10:26:06 $
########
#
# (c) Copyright Hewlett-Packard Company 1994
#
########################################################################
# 
# The purpose of this script is check that the user has not selected more
# than one O.S. license level fileset.  
#
# If there is more than one, the UserLicense PRODUCT will fail the
# installation check, eliminating all the constituent filesets.
#
# If the installation is continued without any license level filesets, the
# kernel will specify the default license level of 2-user.
# 
########################################################################


########

    UTILS=/usr/lbin/sw/control_utils
    if [[ -f $UTILS ]]
    then
        . $UTILS
    else
        echo "ERROR:   Cannot find $UTILS"
        exit 1
    fi


########  List of Mutually Exclusive Filesets

   LICENSES="\
        02-USER  \
        08-USER  \
        16-USER  \
        32-USER  \
        64-USER  \
        UNL-USER "

########  Count Number Selected

    selections=0
    for current in $LICENSES
    do
        if is_software_selected UserLicense.$current
        then
	  (( selections += 1 ))
        fi
    done

    if (( selections > 1 ))
    then
      print "ERROR:   \"UserLicense\" product excluded from installation."
      print "         Only one user license fileset may be installed at a time."
      print "         De-select all but one fileset in the UserLicense product."
      print "         The user license level will, otherwise, default to 2 users."
      exit $FAILURE
    fi

exit $SUCCESS
