diff options
Diffstat (limited to 'sys-freebsd/freebsd-usbin/files/moused.initd')
-rw-r--r-- | sys-freebsd/freebsd-usbin/files/moused.initd | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-usbin/files/moused.initd b/sys-freebsd/freebsd-usbin/files/moused.initd new file mode 100644 index 000000000000..f13f5ec12cda --- /dev/null +++ b/sys-freebsd/freebsd-usbin/files/moused.initd @@ -0,0 +1,66 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +MOUSED_NAME=${SVCNAME##*.} +if [ -n "${MOUSED_NAME}" ] && [ ${MOUSED_NAME} != "moused" ] ; then + MOUSED_DEVICE=/dev/"${MOUSED_NAME}" + MOUSED_PIDFILE=/var/run/moused-"${MOUSED_NAME}".pid +else + MOUSED_NAME= + MOUSED_PIDFILE=/var/run/moused.pid +fi + +depend() { + need localmount +} + +start() { + ebegin "Starting the Console Mouse Daemon" "${MOUSED_NAME}" + + if [ -z ${MOUSED_DEVICE} ] ; then + for x in /dev/psm[0-9]* /dev/ums[0-9]* ; do + if [ -e "${x}" ] && \ + [ ! -e /var/run/moused-$(basename "${x}").pid ] ; then + MOUSED_DEVICE=${x} + eindent + einfo "Using mouse on ${MOUSED_DEVICE}" + eoutdent + break + fi + done + fi + + if [ -z "${MOUSED_DEVICE}" ] ; then + eend 1 "No device specified in" "/etc/conf.d/${SVCNAME}" \ + "and no mouse detected" + return 1 + fi + + local opts="${MOUSED_FLAGS} -p ${MOUSED_DEVICE}" + start-stop-daemon --start --quiet --exec /usr/sbin/moused \ + --pidfile "${MOUSED_PIDFILE}" \ + -- ${opts} -I "${MOUSED_PIDFILE}" + local retval=$? + + [ -n "${MOUSE_CHAR_START}" ] && MOUSE_CHAR_START="-M ${MOUSE_CHAR_START}" + local ttyv= + for ttyv in /dev/ttyv* ; do + vidcontrol < "${ttyv}" ${MOUSE_CHAR_START} -m on || retval=1 + done + + eend ${retval} "Failed to start moused" +} + +stop() { + ebegin "Stopping the Console Mouse Daemon" "${MOUSED_NAME}" + # Don't specify the binary as >1 instance of moused may be running + # which is perfectly valid as we can be multiplexed. + start-stop-daemon --stop --exec /usr/sbin/moused \ + --pidfile "${MOUSED_PIDFILE}" + eend $? "Failed to stop moused" +} + +# vim: set ts=4 : + |