#! /sbin/sh
###############
# Product: *UserLicense
# Fileset: *-USER
# verify
# @(#) $Revision: 1.2.98.1 $
################
#
# (c) Copyright Hewlett-Packard Company, 1994
#
########################################################################
#                                                                      #
# Compare license level as reported by uname to the fileset we are     #
# verifying.                                                           #
#                                                                      #
########################################################################

# Exit Status Variable definitions.

UTILS=/usr/lbin/sw/control_utils
if [[ ! -f $UTILS ]]
then
    print "ERROR:   Cannot find the sh functions library $UTILS."
    exit 1
fi
. $UTILS

running="$(/usr/bin/uname -l)"
if [[ -z "$running" ]]
then
  print "ERROR:   The uname command failed, could not determine license level."
  exit $FAILURE
fi

case "$FILESET" in
  02-USER) shouldbe="two-user license" ;;
  08-USER) shouldbe="8-user license" ;;
  16-USER) shouldbe="16-user license" ;;
  32-USER) shouldbe="32-user license" ;;
  64-USER) shouldbe="64-user license" ;;
  UNL-USER) shouldbe="unlimited-user license" ;;
esac

if [[ "$running" != "$shouldbe" ]]
then
    print "WARNING: Running system is ${running}, instead of ${shouldbe}."
    print "         $FILESET fileset is not properly installed."
    exit $WARNING
fi

exit $SUCCESS
