mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-26 22:06:35 +01:00
9f9119753f
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
66 lines
1.1 KiB
Bash
66 lines
1.1 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Start/Stop/Restart the PC/SC-lite smart card daemon.
|
|
#
|
|
# pcscd should be started after pcmcia and shut down
|
|
# before it for smooth experience with PCMCIA readers.
|
|
#
|
|
|
|
PIDFILE=/var/run/pcscd/pcscd.pid
|
|
PCSCD_OPTS=""
|
|
|
|
# Start
|
|
pcscd_start() {
|
|
if [ -x /usr/sbin/pcscd ]; then
|
|
if [ -e "$PIDFILE" ]; then
|
|
echo "PC/SC-lite daemon already started!"
|
|
else
|
|
echo "Starting PC/SC-lite smart card daemon..."
|
|
/usr/sbin/pcscd $PCSCD_OPTS
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Stop
|
|
pcscd_stop() {
|
|
echo "Stopping PC/SC-lite smart card daemon..."
|
|
if [ -e "$PIDFILE" ]; then
|
|
kill $(cat $PIDFILE)
|
|
rm -f $PIDFILE 2>&1 >/dev/null
|
|
fi
|
|
# Just in case:
|
|
killall pcscd 2>&1 >/dev/null
|
|
}
|
|
|
|
# Restart
|
|
pcscd_restart() {
|
|
pcscd_stop
|
|
sleep 3
|
|
pcscd_start
|
|
}
|
|
|
|
# Status
|
|
pcscd_status() {
|
|
if [ -e "$PIDFILE" ]; then
|
|
echo "pcscd is running."
|
|
else
|
|
echo "pcscd is stopped."
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
pcscd_start
|
|
;;
|
|
'stop')
|
|
pcscd_stop
|
|
;;
|
|
'restart')
|
|
pcscd_restart
|
|
;;
|
|
'status')
|
|
pcscd_status
|
|
;;
|
|
*)
|
|
echo "usage: $0 start|stop|restart|status"
|
|
esac
|