#############################################################################
# 
# Copyright (C)2004-2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Name: enable
# Description: enable for SUNWccfwctrl pkg. This script is required
# of any package which conforms to the Client Framework and is a deamon
#
# pragma ident	"$Id: enable.sh,v 1.2.2.1 2005/03/12 01:13:46 sd148285 Exp $"
##############################################################################

################################################################################
#  Function of the enable 
#  1.  Create the right environment so that the executable can function correctly
#  2.  Make an entry into the /etc/init.d for the executable.
#################################################################################

fw_pkg="SUNWccfw"


createinitdentry()
{
    
    ###
    ##  Check for the presence of the Configuration Framework Package
    ###

    pkginfo $fw_pkg > /dev/null
    if [ $? -ne 0 ] ; then
        $log "postinstall ERROR : The Framework Package $fw_pkg is not available."
        $log "postinstall ERROR : Please install $fw_pkg and retry "
        exit 1
    fi

    ###
    ##  Check for the presence of the registration function of the Framework Package
    ###

    #if [ ! -f  $fw_create_initd_function ] ; then
     #   $log "enable ERROR : Enabling capability not provided by the Framework Package $fw_pkg ."
      #  exit 1
    #fi

    ###
    ## Invoking the create_init entry function with the executable script
    ###

    ##  Send in the path to the executable and the runlevel
    runlevel_file=/usr/lib/cc-cfw/platform/fwagent/runlevel
    executable_script=/usr/lib/cc-cfw/platform/fwagent/cc-fwagent

    $log Creating the initd entry for fwagent
     `/usr/lib/cc-cfw/framework/lib/get_interface CREATE_INITD_ENTRY`  $executable_script $runlevel_file

    $log Setting the status to enabled for fwagent
     `/usr/lib/cc-cfw/framework/lib/get_interface SET_COMPONENT_STATUS`  platform fwagent enabled

}

#######  Main processing logic #######

#
# control logging method
#
log=echo
#log="logger -pdaemon.err"

createinitdentry
exit 0

