#!/bin/ksh -p
#
# $(ID)
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
#

set -u
########################################################################
#
# Enable/Disable Smart Card Services
#
########################################################################

PATH=/usr/bin:/bin:/usr/sbin:/sbin
export PATH

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


#
# disable()
#
disable() {

    svcadm disable svc:/application/security/pcscd:default
    svccfg delete -f pcscd
  
    pkill -9 -f /usr/lib/smartcard/pcscd

    rm -f /var/run/pcscd/fifo/* 
    rm -f /var/run/pcscd/run/* 
}

#
# enable()
#
enable() {

    cd /var/svc/manifest/application/security
    svccfg import pcscd.xml
    svcadm enable svc:/application/security/pcscd:default

}


#########################################
# LOCAL VARIABLES
# They must defined here to resolve the some of parameter resolution
# problem
#########################################
local_variables() {

    return
}


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

#########################################
#
# variables used in the shared script utctl-shlib
#
#########################################

DESCR="Enable/Disable Smart Card Services"

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

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