#!/bin/sh
#
# pcscd		PC/SC Smartcard daemon
#
# chkconfig:    2345 12 88
#
# description:	daemon for pcsc-lite and musclecard framework
#
# $Id: pcsc-lite-pcscd.init,v 1.1 2003/03/11 10:34:10 qboosh Exp $


# Source function library
. /etc/rc.d/init.d/functions

# Set defaults
LOGGING="yes"

# Get service config - may override defaults
[ -f /etc/sysconfig/pcscd ] && . /etc/sysconfig/pcscd

if is_yes "${LOGGING}"; then
	LOGOPT="-d syslog"
else
	LOGOPT=""
fi

# See how we were called.
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/pcscd ]; then
		# show "Starting %s service" pcscd
		msg_starting pcscd
		daemon pcscd $LOGOPT
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/pcscd
	else
		# show "%s service is already running." pcscd
		msg_already_running pcscd
		exit 1
	fi
        ;;
  stop)
        # Stop daemons.
        # show "Stopping %s service" pcscd
	if [ -f /var/lock/subsys/pcscd ]; then
		msg_stopping pcscd
		killproc pcscd
		RETVAL=$?
		rm -f /var/lock/subsys/pcscd
	else
		# show "%s service is not running." pcscd
		msg_not_running pcscd
		exit 1
	fi	
        ;;
  restart|reload|force-reload)
	# pcscd doesn't support reloading on HUP
        $0 stop
	$0 start
        ;;
  status)
	status pcscd
	RETVAL=$?
        ;;
  *)
        # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0
	msg_usage "$0 {start|stop|status|restart|reload|force-reload}"
        exit 1
esac

exit $RETVAL

# This must be last line !
# vi:syntax=sh:tw=78:ts=8:sw=4
