head 1.5; access; symbols netbsd-10-0-RC6:1.5 netbsd-10-0-RC5:1.5 netbsd-10-0-RC4:1.5 netbsd-10-0-RC3:1.5 netbsd-10-0-RC2:1.5 netbsd-10-0-RC1:1.5 netbsd-10:1.5.0.2 netbsd-10-base:1.5 netbsd-9-3-RELEASE:1.4 cjep_sun2x-base1:1.4 cjep_sun2x:1.4.0.82 cjep_sun2x-base:1.4 cjep_staticlib_x-base1:1.4 netbsd-9-2-RELEASE:1.4 cjep_staticlib_x:1.4.0.80 cjep_staticlib_x-base:1.4 netbsd-9-1-RELEASE:1.4 phil-wifi-20200421:1.4 phil-wifi-20200411:1.4 is-mlppp:1.4.0.78 is-mlppp-base:1.4 phil-wifi-20200406:1.4 netbsd-8-2-RELEASE:1.4 netbsd-9-0-RELEASE:1.4 netbsd-9-0-RC2:1.4 netbsd-9-0-RC1:1.4 phil-wifi-20191119:1.4 netbsd-9:1.4.0.76 netbsd-9-base:1.4 phil-wifi-20190609:1.4 netbsd-8-1-RELEASE:1.4 netbsd-8-1-RC1:1.4 pgoyette-compat-merge-20190127:1.4 pgoyette-compat-20190127:1.4 pgoyette-compat-20190118:1.4 pgoyette-compat-1226:1.4 pgoyette-compat-1126:1.4 pgoyette-compat-1020:1.4 pgoyette-compat-0930:1.4 pgoyette-compat-0906:1.4 netbsd-7-2-RELEASE:1.4 pgoyette-compat-0728:1.4 netbsd-8-0-RELEASE:1.4 phil-wifi:1.4.0.74 phil-wifi-base:1.4 pgoyette-compat-0625:1.4 netbsd-8-0-RC2:1.4 pgoyette-compat-0521:1.4 pgoyette-compat-0502:1.4 pgoyette-compat-0422:1.4 netbsd-8-0-RC1:1.4 pgoyette-compat-0415:1.4 pgoyette-compat-0407:1.4 pgoyette-compat-0330:1.4 pgoyette-compat-0322:1.4 pgoyette-compat-0315:1.4 netbsd-7-1-2-RELEASE:1.4 pgoyette-compat:1.4.0.72 pgoyette-compat-base:1.4 netbsd-7-1-1-RELEASE:1.4 matt-nb8-mediatek:1.4.0.70 matt-nb8-mediatek-base:1.4 perseant-stdc-iso10646:1.4.0.68 perseant-stdc-iso10646-base:1.4 netbsd-8:1.4.0.66 netbsd-8-base:1.4 prg-localcount2-base3:1.4 prg-localcount2-base2:1.4 prg-localcount2-base1:1.4 prg-localcount2:1.4.0.64 prg-localcount2-base:1.4 pgoyette-localcount-20170426:1.4 bouyer-socketcan-base1:1.4 pgoyette-localcount-20170320:1.4 netbsd-7-1:1.4.0.62 netbsd-7-1-RELEASE:1.4 netbsd-7-1-RC2:1.4 netbsd-7-nhusb-base-20170116:1.4 bouyer-socketcan:1.4.0.60 bouyer-socketcan-base:1.4 pgoyette-localcount-20170107:1.4 netbsd-7-1-RC1:1.4 pgoyette-localcount-20161104:1.4 netbsd-7-0-2-RELEASE:1.4 localcount-20160914:1.4 netbsd-7-nhusb:1.4.0.58 netbsd-7-nhusb-base:1.4 pgoyette-localcount-20160806:1.4 pgoyette-localcount-20160726:1.4 pgoyette-localcount:1.4.0.56 pgoyette-localcount-base:1.4 netbsd-7-0-1-RELEASE:1.4 netbsd-7-0:1.4.0.54 netbsd-7-0-RELEASE:1.4 netbsd-7-0-RC3:1.4 netbsd-7-0-RC2:1.4 netbsd-7-0-RC1:1.4 netbsd-5-2-3-RELEASE:1.4 netbsd-5-1-5-RELEASE:1.4 netbsd-6-0-6-RELEASE:1.4 netbsd-6-1-5-RELEASE:1.4 netbsd-7:1.4.0.52 netbsd-7-base:1.4 yamt-pagecache-base9:1.4 yamt-pagecache-tag8:1.4 netbsd-6-1-4-RELEASE:1.4 netbsd-6-0-5-RELEASE:1.4 tls-earlyentropy:1.4.0.50 tls-earlyentropy-base:1.4 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.4 riastradh-drm2-base3:1.4 netbsd-6-1-3-RELEASE:1.4 netbsd-6-0-4-RELEASE:1.4 netbsd-5-2-2-RELEASE:1.4 netbsd-5-1-4-RELEASE:1.4 netbsd-6-1-2-RELEASE:1.4 netbsd-6-0-3-RELEASE:1.4 netbsd-5-2-1-RELEASE:1.4 netbsd-5-1-3-RELEASE:1.4 netbsd-6-1-1-RELEASE:1.4 riastradh-drm2-base2:1.4 riastradh-drm2-base1:1.4 riastradh-drm2:1.4.0.42 riastradh-drm2-base:1.4 netbsd-6-1:1.4.0.48 netbsd-6-0-2-RELEASE:1.4 netbsd-6-1-RELEASE:1.4 khorben-n900:1.4.0.46 netbsd-6-1-RC4:1.4 netbsd-6-1-RC3:1.4 agc-symver:1.4.0.44 agc-symver-base:1.4 netbsd-6-1-RC2:1.4 netbsd-6-1-RC1:1.4 yamt-pagecache-base8:1.4 netbsd-5-2:1.4.0.40 netbsd-6-0-1-RELEASE:1.4 yamt-pagecache-base7:1.4 netbsd-5-2-RELEASE:1.4 netbsd-5-2-RC1:1.4 matt-nb6-plus-nbase:1.4 yamt-pagecache-base6:1.4 netbsd-6-0:1.4.0.38 netbsd-6-0-RELEASE:1.4 netbsd-6-0-RC2:1.4 tls-maxphys:1.4.0.36 tls-maxphys-base:1.4 matt-nb6-plus:1.4.0.34 matt-nb6-plus-base:1.4 netbsd-6-0-RC1:1.4 yamt-pagecache-base5:1.4 yamt-pagecache-base4:1.4 netbsd-6:1.4.0.32 netbsd-6-base:1.4 netbsd-5-1-2-RELEASE:1.4 netbsd-5-1-1-RELEASE:1.4 yamt-pagecache-base3:1.4 yamt-pagecache-base2:1.4 yamt-pagecache:1.4.0.30 yamt-pagecache-base:1.4 cherry-xenmp:1.4.0.28 cherry-xenmp-base:1.4 bouyer-quota2-nbase:1.4 bouyer-quota2:1.4.0.26 bouyer-quota2-base:1.4 matt-mips64-premerge-20101231:1.4 matt-nb5-mips64-premerge-20101231:1.4 matt-nb5-pq3:1.4.0.24 matt-nb5-pq3-base:1.4 netbsd-5-1:1.4.0.22 netbsd-5-1-RELEASE:1.4 netbsd-5-1-RC4:1.4 matt-nb5-mips64-k15:1.4 netbsd-5-1-RC3:1.4 netbsd-5-1-RC2:1.4 netbsd-5-1-RC1:1.4 netbsd-5-0-2-RELEASE:1.4 matt-nb5-mips64-premerge-20091211:1.4 matt-premerge-20091211:1.4 matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.4 matt-nb4-mips64-k7-u2a-k9b:1.4 matt-nb5-mips64-u1-k1-k5:1.4 matt-nb5-mips64:1.4.0.20 netbsd-5-0-1-RELEASE:1.4 jym-xensuspend-nbase:1.4 netbsd-5-0:1.4.0.18 netbsd-5-0-RELEASE:1.4 netbsd-5-0-RC4:1.4 netbsd-5-0-RC3:1.4 netbsd-5-0-RC2:1.4 jym-xensuspend:1.4.0.16 jym-xensuspend-base:1.4 netbsd-5-0-RC1:1.4 mjf-devfs2-base2:1.4 netbsd-5:1.4.0.14 netbsd-5-base:1.4 matt-mips64-base2:1.4 matt-mips64:1.2.0.6 wrstuden-revivesa-base-3:1.4 wrstuden-revivesa-base-2:1.4 wrstuden-revivesa-base-1:1.4 yamt-pf42-base4:1.4 yamt-pf42-base3:1.4 hpcarm-cleanup-nbase:1.4 yamt-pf42-baseX:1.4 yamt-pf42-base2:1.4 wrstuden-revivesa:1.4.0.12 wrstuden-revivesa-base:1.4 yamt-pf42:1.4.0.10 yamt-pf42-base:1.4 mjf-devfs2:1.4.0.8 mjf-devfs2-base:1.4 keiichi-mipv6:1.4.0.6 keiichi-mipv6-base:1.4 mjf-devfs:1.4.0.4 mjf-devfs-base:1.4 matt-armv6-nbase:1.4 matt-armv6-prevmlocking:1.2.4.1 cube-autoconf:1.4.0.2 cube-autoconf-base:1.4 matt-armv6:1.2.0.4 matt-armv6-base:1.4 matt-mips64-base:1.2 hpcarm-cleanup:1.2.0.2 hpcarm-cleanup-base:1.4; locks; strict; comment @# @; 1.5 date 2021.11.26.12.51.24; author sborrill; state Exp; branches; next 1.4; commitid 9gsahEAneX3uUiiD; 1.4 date 2007.10.07.05.30.56; author xtraeme; state Exp; branches; next 1.3; 1.3 date 2007.10.07.04.19.07; author xtraeme; state Exp; branches; next 1.2; 1.2 date 2007.07.25.12.47.44; author xtraeme; state Exp; branches 1.2.4.1 1.2.6.1; next 1.1; 1.1 date 2007.07.01.08.01.29; author xtraeme; state Exp; branches; next ; 1.2.4.1 date 2007.11.06.23.10.31; author matt; state Exp; branches; next ; 1.2.6.1 date 2007.07.25.12.47.44; author xtraeme; state dead; branches; next 1.2.6.2; 1.2.6.2 date 2007.07.25.12.47.45; author xtraeme; state Exp; branches; next ; desc @@ 1.5 log @Use rcvar=$name syntax consistently in rc.d scripts which makes it easier to search for rc.d scripts where rcvar differs from name. No functional change. @ text @#!/bin/sh # # $NetBSD: envsys,v 1.4 2007/10/07 05:30:56 xtraeme Exp $ # # PROVIDE: envsys # REQUIRE: LOGIN DAEMON $_rc_subr_loaded . /etc/rc.subr name="envsys" rcvar=$name command="/usr/sbin/envstat" required_files="/etc/envsys.conf" start_cmd="do_start" stop_cmd="do_stop" do_start() { ${command} -c ${required_files} [ $? -eq 0 ] && echo "Setting new sensor properties." } do_stop() { ${command} -S [ $? -eq 0 ] && echo "Removing sensor properties." } load_rc_config ${name} run_rc_command "$1" @ 1.4 log @Only print the message if the command ran successfully. @ text @d3 1 a3 1 # $NetBSD: envsys,v 1.2 2007/07/25 12:47:44 xtraeme Exp $ d12 1 a12 1 rcvar=${name} @ 1.3 log @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! @ text @d5 1 d21 1 a21 1 echo "Setting new sensor properties." d27 1 a27 1 echo "Removing sensor properties." @ 1.2 log @- Ignore lines with desc at start/stop time, this target must be used manually. - Ignore lines with rfact at stop time, they cannot be stopped. Reported by wiz@@. @ text @d3 1 a3 1 # $NetBSD: envsys,v 1.1 2007/07/01 08:01:29 xtraeme Exp $ a4 1 d12 1 d14 2 a15 3 start_cmd="do_envsys start" stop_cmd="do_envsys stop" envsys_bin="/usr/sbin/envstat" d17 1 a17 1 do_envsys() d19 3 a21 6 IFS=":" if [ "$1" = "start" ]; then TARGET="Starting" else TARGET="Stopping" fi d23 4 a26 58 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." @ 1.2.6.1 log @file envsys was added on branch matt-mips64 on 2007-07-25 12:47:45 +0000 @ text @d1 88 @ 1.2.6.2 log @- Ignore lines with desc at start/stop time, this target must be used manually. - Ignore lines with rfact at stop time, they cannot be stopped. Reported by wiz@@. @ text @a0 88 #!/bin/sh # # $NetBSD: envsys,v 1.2 2007/07/25 12:47:44 xtraeme Exp $ # # PROVIDE: envsys # REQUIRE: LOGIN DAEMON $_rc_subr_loaded . /etc/rc.subr name="envsys" rcvar=${name} required_files="/etc/envsys.conf" start_cmd="do_envsys start" stop_cmd="do_envsys stop" envsys_bin="/usr/sbin/envstat" do_envsys() { IFS=":" if [ "$1" = "start" ]; then TARGET="Starting" else TARGET="Stopping" fi 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." } load_rc_config ${name} run_rc_command "$1" @ 1.2.4.1 log @sync with HEAD @ text @d3 1 a3 1 # $NetBSD: envsys,v 1.4 2007/10/07 05:30:56 xtraeme Exp $ a12 1 command="/usr/sbin/envstat" d14 3 a16 2 start_cmd="do_start" stop_cmd="do_stop" d18 1 a18 1 do_start() d20 63 a82 3 ${command} -c ${required_files} [ $? -eq 0 ] && echo "Setting new sensor properties." } d84 1 a84 4 do_stop() { ${command} -S [ $? -eq 0 ] && echo "Removing sensor properties." @ 1.1 log @Add the /etc/rc.d/envsys script required by envsys2. @ text @d3 1 a3 1 # $NetBSD$ d40 17 @