#!/bin/sh

##################################################################
# Copyright ? 2005 Sun Microsystems, Inc. All rights reserved.   #
# Copyright ? 2005 Sun Microsystems, Inc. Tous droits r?serv?s.  #
# SUN PROPRIETARY/CONFIDENTIAL                                   #
##################################################################

#####
#
#  Setup environment
#
#####
BIN_DIR=`dirname "$0"`
CCR=/usr/lib/cc-ccr/bin/ccr
MAIN_JAR="/usr/lib/breg/basicreg.jar"
LD_LIBRARY_PATH="/usr/lib/dc"
export LD_LIBRARY_PATH

######
#
# Check to see if root is invoking this script
#
#####
set `/usr/bin/id`
if [ $1 != "uid=0(root)" ]; then
        echo "$0: must be run as root"
        exit 1
fi

#####
#
# Check to see if we have an asset_id
#
#####
if [ "`$CCR -g cns.assetid`" != "" ]; then
    echo "System currently registered for Solaris and Software Update."
    exit 0;
fi


#####
#
# Run the code
#
#####
cd $BIN_DIR
# WORKAROUND for 1.5 hotspot compiler bug 6208545 is the "-client" flag
exec java -client -jar $MAIN_JAR $*
