1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00
freebsd-ports/devel/linux-js/files/jscal.sh.in
Doug Barton 1d6b4b3f91 Begin the process of deprecating sysutils/rc_subr by
s#. %%RC_SUBR%%#. /etc/rc.subr#
2010-03-27 00:15:24 +00:00

43 lines
859 B
Bash

#!/bin/sh
# $FreeBSD$
# PROVIDE: jscal
# REQUIRE: linux_js
# KEYWORD: shutdown
jscal_enable=${jscal_enable-"NO"}
jscal_devices="${jscal_devices:-/dev/input/js*}"
jscal_state="${jscal_state:-/var/db/jscal-state}"
. /etc/rc.subr
name="jscal"
rcvar=`set_rcvar`
command="%%PREFIX%%/bin/jscal"
start_cmd="jscal_start"
stop_cmd="jscal_stop"
jscal_start()
{
echo "Starting ${name}."
for d in $jscal_devices; do
[ "x$d" = "x$jscal_devices" ] && break
statefile="$jscal_state-`basename $d`"
[ -f "$statefile" ] && . "$statefile" 2>/dev/null
done
}
jscal_stop()
{
echo "Stopping ${name}."
for d in $jscal_devices; do
[ "x$d" = "x$jscal_devices" ] && break
statefile="$jscal_state-`basename $d`"
cal=`"$command" -p "$d" 2>/dev/null` && \
echo "$cal" | sed -e "s|^jscal|$command|" > "$statefile"
done
}
load_rc_config $name
run_rc_command "$1"