Update for the new configuration file format for envstat(8)
and the envsys framework. The rc.d has been simplified vastly... the configuration file now is more powerful than ever!
This commit is contained in:
parent
73b39c8d03
commit
4b431f1771
@ -1,30 +1,42 @@
|
||||
# $NetBSD: envsys.conf,v 1.4 2007/09/05 14:18:55 xtraeme Exp $
|
||||
# $NetBSD: envsys.conf,v 1.5 2007/10/07 04:19:06 xtraeme Exp $
|
||||
#
|
||||
# The format used is the following:
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration file for envstat(8) and the envsys(4) framework.
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
# device:sensor name:target:value
|
||||
# Devices are specified in the first block, sensors in the second block,
|
||||
# and properties inside of the sensor block:
|
||||
#
|
||||
# Note that only one target is allowed per line, see envstat(8)
|
||||
# for more information.
|
||||
# foo0 {
|
||||
# sensor0 { ... }
|
||||
# }
|
||||
#
|
||||
# Example:
|
||||
# Properties must be separated by a semicolon character and assigned by
|
||||
# using the equal character:
|
||||
#
|
||||
#acpitz0:acpitz0 temperature:critmax:80
|
||||
#acpitz0:acpitz0 temperature:critmin:10
|
||||
#acpitz1:acpitz1 temperature:critmax:90
|
||||
#acpitz1:acpitz1 temperature:critmin:15
|
||||
# critical-capacity = 10;
|
||||
#
|
||||
# ========================================================
|
||||
# ADDITIONAL CONFIGURATION FOR SPECIFIC MOTHERBOARDS/CHIPS
|
||||
# ========================================================
|
||||
# Please see the envsys.conf(5) manual page for a detailed explanation.
|
||||
#
|
||||
# The following entry gives the correct values for the ASUS M2N-E
|
||||
# motherboard using the it(4) driver:
|
||||
#
|
||||
# It seems that VCORE_B is +3.3V.
|
||||
# ----------------------------------------------------------------------
|
||||
# CONFIGURATION FILES FOR SPECIFIC DRIVERS AND MOTHERBOARDS
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
#it0:VCORE_A:rfact:1800000
|
||||
#it0:VCORE_B:rfact:2000000
|
||||
#it0:+5V:rfact:3490000
|
||||
#it0:+12V:rfact:8500000
|
||||
# The following configuration properties will report the correct
|
||||
# values for the ASUS M2N-E motherboard using the it(4) driver:
|
||||
#
|
||||
# it0 {
|
||||
# # VCORE_A
|
||||
# sensor3 { rfact = 1800000; }
|
||||
#
|
||||
# # VCORE_B = +3.3V
|
||||
# sensor4 { rfact = 2000000; description = "+3.3V" };
|
||||
#
|
||||
# # +5.5V
|
||||
# sensor5 { rfact = 3490000; }
|
||||
#
|
||||
# # +12V
|
||||
# sensor6 { rfact = 8500000; }
|
||||
# }
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: envsys,v 1.2 2007/07/25 12:47:44 xtraeme Exp $
|
||||
# $NetBSD: envsys,v 1.3 2007/10/07 04:19:07 xtraeme Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: envsys
|
||||
# REQUIRE: LOGIN DAEMON
|
||||
|
||||
@ -10,78 +9,21 @@ $_rc_subr_loaded . /etc/rc.subr
|
||||
|
||||
name="envsys"
|
||||
rcvar=${name}
|
||||
command="/usr/sbin/envstat"
|
||||
required_files="/etc/envsys.conf"
|
||||
start_cmd="do_envsys start"
|
||||
stop_cmd="do_envsys stop"
|
||||
envsys_bin="/usr/sbin/envstat"
|
||||
start_cmd="do_start"
|
||||
stop_cmd="do_stop"
|
||||
|
||||
do_envsys()
|
||||
do_start()
|
||||
{
|
||||
IFS=":"
|
||||
if [ "$1" = "start" ]; then
|
||||
TARGET="Starting"
|
||||
else
|
||||
TARGET="Stopping"
|
||||
fi
|
||||
${command} -c ${required_files}
|
||||
echo "Setting new sensor properties."
|
||||
}
|
||||
|
||||
while read -r device sensname target value; do
|
||||
case "${device}" in
|
||||
\#*|"")
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${value}" in
|
||||
*degF)
|
||||
add_arg="-f"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
case "${target}" in
|
||||
*desc)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
case "${target}" in
|
||||
*desc|*rfact)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -z ${device} ] && err_msg="missing device"
|
||||
[ -z ${target} ] && err_msg="missing target"
|
||||
[ -z ${value} ] && err_msg="missing value"
|
||||
|
||||
if [ -n "${err_msg}" ]; then
|
||||
echo "${name}: invalid entry (${err_msg})."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "start" ]; then
|
||||
${envsys_bin} \
|
||||
${add_arg} \
|
||||
-d ${device} \
|
||||
-s "${sensname}" \
|
||||
-m ${target}=${value%%degF}
|
||||
else
|
||||
${envsys_bin} \
|
||||
${add_arg} \
|
||||
-d ${device} \
|
||||
-s "${sensname}" \
|
||||
-m ${target}=remove
|
||||
fi
|
||||
|
||||
# reinitialize the var
|
||||
add_arg=
|
||||
done < ${required_files}
|
||||
|
||||
echo "$TARGET sensors monitoring."
|
||||
do_stop()
|
||||
{
|
||||
${command} -S
|
||||
echo "Removing sensor properties."
|
||||
}
|
||||
|
||||
load_rc_config ${name}
|
||||
|
Loading…
Reference in New Issue
Block a user