#!/sbin/runscript # Copyright 2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/app-crypt/ekeyd/files/ekey-ulusbd.init,v 1.3 2009/10/04 11:43:34 flameeyes Exp $ INSTANCE="${SVCNAME#*.}" if [ -z "${INSTANCE}" ] || [ "${SVCNAME}" = "ekey-ulusbd" ]; then INSTANCE="ekey-ulusbd" fi depend() { need localmount } start() { if [ -z ${USB_BUS} ]; then set -- $(lsusb -v -d 20df:0001 | \ egrep '(^Bus|iSerial)' | \ grep -B1 "${EKEY_SERIAL}" | \ head -n 1 | \ cut -c 5-7,15-18) USB_BUS=$1 USB_DEV=$2 fi ebegin "Starting EntropyKey Userland USB Daemon" start-stop-daemon \ --start --pidfile "/var/run/${SVCNAME}.pid" \ --exec /usr/libexec/ekey-ulusbd -- \ -P "/var/run/${SVCNAME}.pid" \ -p "${SOCKET_PATH}" \ -b $(printf %03d ${USB_BUS}) -d $(printf %03d ${USB_DEV}) -D eend $? } stop() { ebegin "Stopping EntropyKey daemon" start-stop-daemon \ --stop --pidfile "/var/run/${SVCNAME}.pid" \ --exec /usr/libexec/ekey-ulusbd eend $? }