#!/bin/ksh -p
#
# ident "@(#)utsunmcctl.ksh	1.5 05/06/01 SMI"
#
# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

set -u
########################################################################
#
# Configures SunMC Agent
#
########################################################################


########################################################################
#
# Operation entry points, one for each keyword.  This is where the
# specific work for this feature happens.
#
########################################################################

#
# disable()
#
disable() {

	if [ -d ${SUNWUTETC} ]; then
		rm -f ${SUNWUTETC}/utsservices.cfg
	fi

	# Remove the SunMC links to the files to be removed
	#
	if [ -x ${UTSUNMC} ]; then
		${UTSUNMC} -u
		if $VERB; then
			print "SunMC configuration disabled"
		fi
	fi

	return 0

}

#
# enable()
#
enable() {

	if [ -d ${SUNWUTETC} ] && [ -f ${SUNWUT}/etc/template/utsservices.cfg ]; then
		cp ${SUNWUT}/etc/template/utsservices.cfg \
		   ${SUNWUTETC}/utsservices.cfg
	fi

	# Add the SunMC links to the files if SunMC is installed
	#
	if [ -x ${UTSUNMC} ]; then
		${UTSUNMC} -f
		if $VERB; then
			print "SunMC configuration enabled"
		fi
	fi

	return 0

}

#########################################
# LOCAL VARIABLES
# They must defined here to resolve the some of parameter resolution
# problem
#########################################
local_variables() {
	UTSUNMC=$SUNWUT/sbin/utsunmc
	return
}

########################################################################
#
# Configurable parameter
#
########################################################################
# NONE

#########################################
#
# variables used in the shared script utctl-shlib
#
#########################################
DESCR="sets up SunMC Agent configuration"


########################################################################
#
# Execution starts here
#

PROGPATH=`dirname $0`
. $PROGPATH/utctl-shlib
