diff options
author | LukenShiro <lukenshiro@ngi.it> | 2010-05-11 22:55:25 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-11 22:55:25 +0200 |
commit | 36cfa2e44bffd3aa5a2d41ced82ca7c0befb23e2 (patch) | |
tree | b5f5797dfb7eefb95b7e90db3dc3dca327c1e0b0 /system/openct/rc.openctd | |
parent | 16f4ae2412477a16ae85a2228e2b806c806b6ac9 (diff) |
system/openct: Added to 12.1 repository
Diffstat (limited to 'system/openct/rc.openctd')
-rw-r--r-- | system/openct/rc.openctd | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/system/openct/rc.openctd b/system/openct/rc.openctd new file mode 100644 index 000000000000..93244034aede --- /dev/null +++ b/system/openct/rc.openctd @@ -0,0 +1,64 @@ +#! /bin/sh +# +# rc.openctd +# based on original upstream openct's init-script, modified for +# SlackBuilds.org by LukenShiro <lukenshiro<at>ngi.it> + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/openct-control +NAME="OpenCT smart card terminal framework" +OPENCT_OPTS="" + +set -e + +openctd_start() { + if [ -x $DAEMON ]; then + echo "Starting $NAME ..." + # create the directory for our status and socket files, + # if it does not exist. + [[ -e "/var/run/openct" ]] || mkdir -p /var/run/openct + + # maybe you also want to set ownership and permissions here. + # this example would assign the directory to a group "plugdev" + # and set permissions so only users in that group can access + # smart card readers via openct. + #chown root:plugdev /var/run/openct + #chmod 0750 /var/run/openct + + $DAEMON $OPENCT_OPTS init + fi +} + +openctd_stop() { + if [ -x $DAEMON ]; then + echo "Starting $NAME ..." + $DAEMON $OPENCT_OPTS shutdown + + # remove old status (just in case) + [[ -e "/var/run/openct/status" ]] && rm -f /var/run/openct/status + # remove socket and lock files (they seem not to be deleted by daemon) + rm -f /var/run/openct/0 /var/run/openct/status.lock* 2>&1 >/dev/null + fi +} + +openctd_restart() { + openctd_stop + sleep 0.1 # keep original sleep duration + openctd_start +} + +case "$1" in + 'start') + openctd_start + ;; + 'stop') + openctd_stop + ;; + 'restart') + openctd_restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" >&2 + exit 1 + ;; +esac |