4
# Required-Start: $local_fs $remote_fs $syslog
5
# Required-Stop: $local_fs $remote_fs $syslog
8
# Default-Start: 2 3 4 5
10
# Short-Description: Daemon to access a smart card using PC/SC
11
# Description: The PC/SC daemon is used to dynamically
12
# allocate/deallocate reader drivers at runtime and manage
13
# connections to the readers.
17
# Carlos Prados Bocos <cprados@debian.org>
18
# Ludovic Rousseau <rousseau@debian.org>
22
# PATH should only include /usr/* if it runs after the mountnfs.sh script
23
PATH=/sbin:/usr/sbin:/bin:/usr/bin
24
DESC="PCSC Lite resource manager"
26
DAEMON=/usr/sbin/$NAME
28
PIDFILE=$IPCDIR/$NAME.pid
29
SCRIPTNAME=/etc/init.d/$NAME
31
# if you need to pass arguments to pcscd you should edit the file
32
# /etc/default/pcscd and add a line
33
# DAEMON_ARGS="--your-option"
35
# Exit if the package is not installed
36
[ -x "$DAEMON" ] || exit 0
38
# Read configuration variable file if it is present
39
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
41
# Load the VERBOSE setting and other rcS variables
44
# Define LSB log_* functions.
45
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
46
. /lib/lsb/init-functions
48
# get LANG variable (code from /etc/init.d/keymap.sh)
50
[ -r /etc/environment ] && ENV_FILE="/etc/environment"
51
[ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale"
53
value=$(egrep "^[^#]*LANG=" $ENV_FILE | tail -n1 | cut -d= -f2)
57
# Function that starts the daemon/service
61
# create $IPCDIR with correct access rights
70
# 0 if daemon has been started
71
# 1 if daemon was already running
72
# 2 if daemon could not be started
73
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
75
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
78
# Add code here, if necessary, that waits for the process to be ready
79
# to handle requests from services started subsequently which depend
80
# on this one. As a last resort, sleep for some time.
84
# Function that stops the daemon/service
89
# 0 if daemon has been stopped
90
# 1 if daemon was already stopped
91
# 2 if daemon could not be stopped
92
# other if a failure occurred
93
start-stop-daemon --stop --quiet --retry=3 --pidfile $PIDFILE --name $NAME
95
[ "$RETVAL" = 2 ] && return 2
100
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
103
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
104
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
108
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
111
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
112
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
116
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
118
restart|force-reload)
120
# If the "reload" option is implemented then remove the
121
# 'force-reload' alias
123
log_daemon_msg "Restarting $DESC" "$NAME"
130
1) log_end_msg 1 ;; # Old process is still running
131
*) log_end_msg 1 ;; # Failed to start
141
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2