#!/sbin/svc

# Startup for the Spyrus Lynks Privacy card

MYLISTING="Spyrus Lynks card"
CONTROL_GROUP="spyrus"

# Note there is no permanently running daemon.  We just load the driver and
# then try to prime it with the user PIN phrase and a default Signature
# slot selection.

SPYDIR=/etc/spyrus
SPYCFG=$SPYDIR/spyrus.local
SPYDSA=$SPYDIR/dsaparam.pem.local
SPYUTIL=/usr/sbin/spyrus_util

SPYENABLE="0"
[ -r $SPYCFG ] && source $SPYCFG

start() {
	# SmartCard-HSM
	#(while true; do /usr/sbin/pcscd --apdu --foreground --debug --auto-exit -T; done) &

	# Only do anything if we've been enabled in the config file
	if [ "${SPYENABLE}" -eq 0 ]
	then
		return 0
	fi

	# Create a DSA parameters file if it doesn't exist, this may take a
	# minute or so but we don't have to wait for completion here.
	[ -d $SPYDIR ] || mkdir -p $SPYDIR
	[ -r $SPYDSA ] || openssl dsaparam -out $SPYDSA 1024 > /dev/null 2>&1 &
}

