opnsense-ports/sysutils/asusoled/files/asusoled.in
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

54 lines
1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: asusoled
# REQUIRE: DAEMON
# KEYWORD: nojail shutdown
#
# Add the following lines to /etc/rc.conf to enable the ASUS OLED display:
#
# asusoled_enable="YES"
#
asusoled_enable=${asusoled_enable-"NO"}
asusoled_flags=${asusoled_flags-"-f %%PREFIX%%/share/asusoled/asus.png"}
asusoled_command=${asusoled_command-""}
. /etc/rc.subr
name=asusoled
rcvar=asusoled_enable
start_cmd=asusoled_start
stop_cmd=asusoled_stop
asusoled_bin="%%PREFIX%%/sbin/asusoled"
asusoled_pidfile="/var/run/${name}.pid"
asusoled_start() {
if checkyesno asusoled_enable
then
echo "Starting asusoled."
${asusoled_bin} -e || exit 1
if test ! -z "${asusoled_command}"
then
${asusoled_bin} ${asusoled_flags} -c "${asusoled_command}"
else
${asusoled_bin} ${asusoled_flags}
fi
fi
}
asusoled_stop() {
if checkyesno asusoled_enable
then
echo "Stopping asusoled."
test -f ${asusoled_pidfile} &&
${asusoled_bin} -k -p ${asusoled_pidfile}
${asusoled_bin} -d
fi
}
load_rc_config ${name}
run_rc_command "$1"