# Copyright (c) 1996-2002 Sun Microsystems, Inc.  All Rights Reserved. Sun
# considers its source code as an unpublished, proprietary trade secret, and
# it is available only under strict license provisions.  This copyright
# notice is placed here only to protect Sun in the event the source is
# deemed a published work.  Dissassembly, decompilation, or other means of
# reducing the object code to human readable form is prohibited by the
# license agreement under which this code is provided to the user or company
# in possession of this copy.
#
# RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the Government
# is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the
# Rights in Technical Data and Computer Software clause at DFARS 52.227-7013
# and in similar clauses in the FAR and NASA FAR Supplement.
#

SMCREG=${ROOTDIR}/usr/sadm/bin/smcregister
WBEMINIT=${ROOTDIR}/etc/init.d/init.wbem
ADMIN_LIBDIR=${ROOTDIR}/usr/sadm/lib
MOFREG=${ROOTDIR}/usr/sadm/bin/mofreg
MOFDIR=${ROOTDIR}/usr/sadm/mof
TEMP=${ROOTDIR}/var/tmp
export ROOTDIR

LANGS='de es fr it sv ko zh zh_TW zh_HK ja'


# Register tools and services
if [ -x ${SMCREG} -a "${ROOTDIR}" = "/" -a -d "${ROOTDIR}/var/sadm/smc" ]; then
        for i in $LANGS
        do
        	if [ -f ${ADMIN_LIBDIR}/patchmgr/VPatchMgr_${i}.jar ]; then
			${SMCREG} library -n VPatchMgr_${i}.jar \
		        ${ADMIN_LIBDIR}/patchmgr/VPatchMgr_${i}.jar \
			${ADMIN_LIBDIR}/patchmgr/VPatchMgr_${i}_classlist.txt \
			com.sun.admin.patchmgr.client.VPatchMgr
		fi

		if [ -f ${ADMIN_LIBDIR}/patchmgr/PatchMgrCli_${i}.jar ]; then	
			${SMCREG} library -n PatchMgrCli_${i}.jar \
	            	${ADMIN_LIBDIR}/patchmgr/PatchMgrCli_${i}.jar \
	            	${ADMIN_LIBDIR}/patchmgr/PatchMgrCli_${i}_classlist.txt \
			com.sun.admin.patchmgr.cli.PatchMgrCli
		fi
	done
	
	running=`env LC_ALL=C ${WBEMINIT} status | grep "not running"`
        if [ -x ${WBEMINIT} -a -z "${running}" ]; then
                ${WBEMINIT} stop
                ${WBEMINIT} start
        fi
fi

exit 0
