ports/devel/linux-js/files/jscal.sh.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not, to prepare for the demise of set_rcvar().

In cases where I had to hand-edit unusual instances also
modify formatting slightly to be more uniform (and in
some cases, correct). This includes adding some $FreeBSD$
tags, and most importantly moving rcvar= to right after
name= so it's clear that one is derived from the other.
2012-01-14 08:57:23 +00:00

42 lines
860 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=jscal_enable
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"