Add the /etc/rc.d/envsys script required by envsys2.
This commit is contained in:
parent
08d5afa292
commit
bca6ba70fe
@ -1,4 +1,4 @@
|
||||
# $NetBSD: mi,v 1.191 2007/07/01 07:55:52 xtraeme Exp $
|
||||
# $NetBSD: mi,v 1.192 2007/07/01 08:01:29 xtraeme Exp $
|
||||
#
|
||||
# Note: end-user configuration files that are moved to another location
|
||||
# should not be marked "obsolete"; they should just be removed from
|
||||
@ -176,6 +176,7 @@
|
||||
./etc/rc.d/dhcrelay etc-dhcpd-rc
|
||||
./etc/rc.d/dmesg etc-sys-rc
|
||||
./etc/rc.d/downinterfaces etc-sys-rc
|
||||
./etc/rc.d/envsys etc-sys-rc
|
||||
./etc/rc.d/fixsb etc-sys-rc
|
||||
./etc/rc.d/fsck etc-sys-rc
|
||||
./etc/rc.d/fsck.sh etc-obsolete obsolete
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: special,v 1.112 2007/07/01 07:55:53 xtraeme Exp $
|
||||
# $NetBSD: special,v 1.113 2007/07/01 08:01:29 xtraeme Exp $
|
||||
# @(#)special 8.2 (Berkeley) 1/23/94
|
||||
#
|
||||
# This file may be overwritten on upgrades.
|
||||
@ -191,6 +191,7 @@
|
||||
./etc/rc.d/dhcrelay type=file mode=0555
|
||||
./etc/rc.d/dmesg type=file mode=0555
|
||||
./etc/rc.d/downinterfaces type=file mode=0555
|
||||
./etc/rc.d/envsys type=file mode=0555
|
||||
./etc/rc.d/fixsb type=file mode=0555
|
||||
./etc/rc.d/fsck type=file mode=0555
|
||||
./etc/rc.d/ftpd type=file mode=0555
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.64 2007/02/20 21:29:08 briggs Exp $
|
||||
# $NetBSD: Makefile,v 1.65 2007/07/01 08:01:29 xtraeme Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
@ -12,7 +12,7 @@ CONFIGFILES=\
|
||||
accounting altqd amd apmd \
|
||||
bootconf.sh bootparams btconfig btdevctl bthcid btuartd \
|
||||
ccd cgd cleartmp cron \
|
||||
dhclient dhcpd dhcrelay dmesg downinterfaces \
|
||||
dhclient dhcpd dhcrelay dmesg downinterfaces envsys \
|
||||
fixsb fsck ftpd \
|
||||
hostapd \
|
||||
identd ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec \
|
||||
|
71
etc/rc.d/envsys
Executable file
71
etc/rc.d/envsys
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: envsys,v 1.1 2007/07/01 08:01:29 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
|
||||
|
||||
[ -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"
|
Loading…
Reference in New Issue
Block a user