summaryrefslogtreecommitdiffstats
path: root/abs/extra/lm_sensors
diff options
context:
space:
mode:
authorCecil Hugh Watson <knoppmyth@gmail.com>2010-09-05 06:13:57 (GMT)
committerCecil Hugh Watson <knoppmyth@gmail.com>2010-09-05 06:13:57 (GMT)
commitb172f79fadb565ecfbcec9508f9377d8618a4f4c (patch)
treebf8823b07e3313c3afa000a9b31e4f9a735cb818 /abs/extra/lm_sensors
parentf9d54ab7c3853208484e304bc6cf40ab0f79d400 (diff)
parent5e7027c6194237ca1dc5fcbb3648483a970fb500 (diff)
downloadlinhes_pkgbuild-b172f79fadb565ecfbcec9508f9377d8618a4f4c.zip
linhes_pkgbuild-b172f79fadb565ecfbcec9508f9377d8618a4f4c.tar.gz
linhes_pkgbuild-b172f79fadb565ecfbcec9508f9377d8618a4f4c.tar.bz2
Merge branch 'HEAD' of ssh://cesman@knoppmyth.net/mount/repository/LinHES-PKGBUILD
Diffstat (limited to 'abs/extra/lm_sensors')
-rw-r--r--abs/extra/lm_sensors/ChangeLog50
-rw-r--r--abs/extra/lm_sensors/PKGBUILD65
-rw-r--r--abs/extra/lm_sensors/fancontrol.rc5
-rw-r--r--abs/extra/lm_sensors/healthd46
-rw-r--r--abs/extra/lm_sensors/healthd.conf16
-rw-r--r--abs/extra/lm_sensors/healthd.rc52
-rw-r--r--abs/extra/lm_sensors/sensord.conf4
-rw-r--r--abs/extra/lm_sensors/sensord.rc37
-rw-r--r--abs/extra/lm_sensors/sensors-detect.patch114
-rw-r--r--abs/extra/lm_sensors/sensors.rc106
10 files changed, 348 insertions, 147 deletions
diff --git a/abs/extra/lm_sensors/ChangeLog b/abs/extra/lm_sensors/ChangeLog
new file mode 100644
index 0000000..dfec49d
--- /dev/null
+++ b/abs/extra/lm_sensors/ChangeLog
@@ -0,0 +1,50 @@
+2010-02-02 Eric Belanger <eric@archlinux.org>
+
+ * lm_sensors 3.1.2-1
+ * Upstream update
+ * Fixed fancontrol daemon script (close FS#17775)
+
+2009-11-23 Eric Belanger <eric@archlinux.org>
+
+ * lm_sensors 3.1.1-4
+ * Added more configs in backup array (close FS#17260)
+ * Changed rrdtool optdepends to a depends
+
+2009-11-20 Eric Belanger <eric@archlinux.org>
+
+ * lm_sensors 3.1.1-3
+ * Fixed stopping of fancontrol daemon script (close FS#17083)
+ * Fixed healthd script (close FS#17089)
+
+2009-09-28 Eric Belanger <eric@archlinux.org>
+
+ * lm_sensors 3.1.1-2
+ * Fixed fancontrol daemon script (close FS#15269)
+ * Added sensord daemon script (close FS#15811)
+
+2009-06-24 Eric Belanger <eric@archlinux.org>
+
+ * lm_sensors 3.1.1-1
+ * Upstream update
+ * Added healthd daemon (close FS#14597)
+
+2009-03-03 Eric Belanger <eric@archlinux.org>
+
+ * lm_sensors 3.1.0-1
+ * Upstream update
+ * Updated sensors-detect.patch
+
+2009-01-03 Eric Belanger <eric@archlinux.org>
+
+ * lm_sensors 3.0.3-2
+ * Rebuilt against rrdtool 1.3.5
+
+2008-11-08 Eric Belanger <eric@archlinux.org>
+
+ * lm_sensors 3.0.3-1
+ * Upstream update
+ * Updated sensors-detect.patch patch
+ * FHS man pages
+ * Changed sensors daemon script to move config in new location (cf. FS#9516)
+ * Did several other fixes and clean up in sensors daemon script
+ * Added ChangeLog
diff --git a/abs/extra/lm_sensors/PKGBUILD b/abs/extra/lm_sensors/PKGBUILD
index 487a6fe..226139a 100644
--- a/abs/extra/lm_sensors/PKGBUILD
+++ b/abs/extra/lm_sensors/PKGBUILD
@@ -1,41 +1,44 @@
-# $Id: PKGBUILD 8687 2008-08-15 15:06:46Z andyrtr $
-# Maintainer: aurelien <aurelien@archlinux.org>
+# $Id: PKGBUILD 67093 2010-02-03 03:55:56Z eric $
+# Maintainer: Eric Belanger <eric@archlinux.org>
# Contributor: Aurelien Foret <orelien@chez.com>
+
pkgname=lm_sensors
-pkgver=3.0.2
-pkgrel=2
-pkgdesc="Collection of user space tools for general SMBus access and hardware monitoring."
+pkgver=3.1.2
+pkgrel=7
+pkgdesc="Collection of user space tools for general SMBus access and hardware monitoring"
arch=('i686' 'x86_64')
+url="http://www.lm-sensors.org/"
license=('GPL')
-depends=('perl' 'sysfsutils')
-makedepends=('bison' 'flex' 'rrdtool')
-optdepends=('rrdtool: for logging with sensord')
-backup=(etc/sensors3.conf)
+depends=('perl' 'sysfsutils' 'rrdtool')
+backup=('etc/sensors3.conf' 'etc/conf.d/healthd' 'etc/conf.d/sensord')
+options=('!emptydirs')
install=sensors.install
-source=(http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-$pkgver.tar.bz2
- sensors.rc
- fancontrol.rc
- sensors-detect.patch)
-url="http://www.lm-sensors.org/"
-md5sums=('5b210ba9cc01f00161c438fd618484e5'
- 'c9f7f38964963ae3ced4dff3f1f0b7b9'
- 'f14e335a8eea27388892c36af8099782'
- '6fd30ed1e5ac739b8a27f3913ba706f4')
+source=(http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-${pkgver}.tar.bz2 \
+ sensors.rc fancontrol.rc sensors-detect.patch healthd healthd.conf healthd.rc \
+ sensord.conf sensord.rc)
+md5sums=('58a9a225808ac4587c4c8cbd12b40b5c' 'c370f5e620bfe41113354a1e22c0c18c'\
+ '1e04aad66debdb72557b4528bf79b742' '47c40b381d1f25d6634ae84cecf35f33'\
+ '6549050897c237514aeaa2bb6cfd29ea' 'f649261f52bd4329347bf93f5f83cb0a'\
+ '970408d2e509dc4138927020efefe323' '96a8dd468e81d455ec9b165bdf33e0b7'\
+ '41a5c20854bbff00ea7174bd2276b736')
+sha1sums=('4a3b13e4f9c18c29e7f853739bdd88ca7799fcc7' 'b2e664b9b87759991f02d0a1e8cac5e95098c0a5'\
+ '66f3cdde688127f4e4e81b5ec3c180149b5c36ea' '47095a32a918d6be50bd8daa8aaa9c24940d60e9'\
+ '78b5cd36c3cb8e98b972cdd8c4a12687d79a79a8' 'c6ddfebc20685ba69700f66038c6b00a7c0bdb80'\
+ 'e662881f5d3f3f35a1bc97ba45d2c471dd28c37f' 'de8d4d65406815c389f8a04e2a8508a1ae6749c8'\
+ '72a60251d1d55a67307dab4105d9f3f01a080af4')
build() {
- cd ${srcdir}/$pkgname-$pkgver
- patch -Np0 -i ${srcdir}/sensors-detect.patch || return 1
-
- make PREFIX=/usr PROG_EXTRA:=sensord user || return 1
- make user_install PREFIX=/usr DESTDIR=${pkgdir}
- install -DT -m755 ${srcdir}/$pkgname-$pkgver/prog/sensord/sensord ${pkgdir}/usr/sbin/sensord
-
- install -DT -m755 ${srcdir}/sensors.rc ${pkgdir}/etc/rc.d/sensors
- install -DT -m755 ${srcdir}/fancontrol.rc ${pkgdir}/etc/rc.d/fancontrol
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -p1 < ../sensors-detect.patch || return 1
- # remove the static lib
- rm -rf ${pkgdir}/usr/lib/libsensors.a
+ make PROG_EXTRA=sensord BUILD_STATIC_LIB=0 \
+ PREFIX=/usr MANDIR=/usr/share/man DESTDIR="${pkgdir}" install || return 1
- # FIXME: avoid conflicts with glibc headers
- rm -rf ${pkgdir}/usr/include/linux
+ install -D -m755 "${srcdir}/sensors.rc" "${pkgdir}/etc/rc.d/sensors" || return 1
+ install -D -m755 "${srcdir}/fancontrol.rc" "${pkgdir}/etc/rc.d/fancontrol" || return 1
+ install -D -m755 "${srcdir}/healthd" "${pkgdir}/usr/sbin/healthd" || return 1
+ install -D -m755 "${srcdir}/healthd.rc" "${pkgdir}/etc/rc.d/healthd" || return 1
+ install -D -m644 "${srcdir}/healthd.conf" "${pkgdir}/etc/conf.d/healthd" || return 1
+ install -D -m755 "${srcdir}/sensord.rc" "${pkgdir}/etc/rc.d/sensord" || return 1
+ install -D -m644 "${srcdir}/sensord.conf" "${pkgdir}/etc/conf.d/sensord" || return 1
}
diff --git a/abs/extra/lm_sensors/fancontrol.rc b/abs/extra/lm_sensors/fancontrol.rc
index 7fc1bbf..bce5d7e 100644
--- a/abs/extra/lm_sensors/fancontrol.rc
+++ b/abs/extra/lm_sensors/fancontrol.rc
@@ -3,10 +3,11 @@
. /etc/rc.conf
. /etc/rc.d/functions
+PID=$(pidof -o %PPID -x /usr/sbin/fancontrol)
case "$1" in
start)
stat_busy "Starting fancontrol"
- /usr/sbin/fancontrol >/dev/null 2>&1 &
+ [ -z "$PID" ] && /usr/sbin/fancontrol >/dev/null 2>&1 &
if [ $? -gt 0 ]; then
stat_fail
else
@@ -16,7 +17,7 @@ case "$1" in
;;
stop)
stat_busy "Stopping fancontrol"
- [ -f /var/run/fancontrol.pid ] && kill `cat /var/run/fancontrol.pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
diff --git a/abs/extra/lm_sensors/healthd b/abs/extra/lm_sensors/healthd
new file mode 100644
index 0000000..0315dd7
--- /dev/null
+++ b/abs/extra/lm_sensors/healthd
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+#
+# /usr/sbin/healthd
+#
+
+. /etc/conf.d/healthd
+
+cmd="${ALARM_CMD}"
+addr="${ADMIN_EMAIL}"
+slp="${ALARM_SLEEP}"
+sensors="/usr/bin/sensors"
+
+
+while [ $# -gt 0 ] ; do
+ case "${1}" in
+ -c ) cmd="${2}" ; shift 2 ;;
+ -m ) addr="${2}" ; shift 2 ;;
+ -s ) slp="${2}" ; shift 2 ;;
+ * ) shift 1 ;;
+ esac
+done
+
+[ -n "${cmd}" ] && [ -n "$( which -- "${cmd%% *}" )" ] || \
+ [ -n "${addr}" ] || exit 1
+
+[ "${slp}" -ge 2 ] || slp=600
+
+while true ; do
+ sleep 15
+ message="$( $sensors )"
+ case "$message" in
+ '' ) message='Could not get any sensor values !' ;;
+ *ALARM* ) : ;;
+ * ) message='' ;;
+ esac
+ if [ -n "$message" ]; then
+ if [ -n "${addr}" ]; then
+ echo "$message" | mail -s \
+ "Sensors ALARM detected at host: $( hostname )" \
+ "${addr}"
+ fi
+ [ -z "${cmd}" ] || ${cmd} &
+ sleep ${slp}
+ fi
+done &
diff --git a/abs/extra/lm_sensors/healthd.conf b/abs/extra/lm_sensors/healthd.conf
new file mode 100644
index 0000000..36c5f55
--- /dev/null
+++ b/abs/extra/lm_sensors/healthd.conf
@@ -0,0 +1,16 @@
+#
+# /etc/conf.d/healthd
+#
+
+# reset any pending alarms on startup
+ALARM_RESET="yes"
+
+# where to sent mails on alarm
+ADMIN_EMAIL="root"
+
+# Seconds to sleep when alarm detected before checking again
+# If you want to fill up your mail inbox set this to 2. ;-)
+ALARM_SLEEP=600
+
+# command to run in background on each alarm
+ALARM_CMD="beep -f 800 -l 500 -d 500 -r 600"
diff --git a/abs/extra/lm_sensors/healthd.rc b/abs/extra/lm_sensors/healthd.rc
new file mode 100644
index 0000000..7bb7951
--- /dev/null
+++ b/abs/extra/lm_sensors/healthd.rc
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+#
+# /etc/rc.d/healthd
+#
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/healthd
+
+maybe_alarm_reset() {
+ case "${ALARM_RESET}" in
+ yes) /usr/bin/sensors > /dev/null
+ ;;
+ no) true
+ ;;
+ *) false
+ esac
+ return $?
+}
+
+PID=$(pidof -x -o %PPID /usr/sbin/healthd)
+case "${1}" in
+ start)
+ stat_busy "Starting Health Daemon"
+ [ -z "${PID}" ] && maybe_alarm_reset && /usr/sbin/healthd &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo "${PID}" > /var/run/healthd.pid
+ add_daemon healthd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Health Daemon"
+ [ ! -z "${PID}" ] && kill ${PID} &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon healthd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *) echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/abs/extra/lm_sensors/sensord.conf b/abs/extra/lm_sensors/sensord.conf
new file mode 100644
index 0000000..a1cf091
--- /dev/null
+++ b/abs/extra/lm_sensors/sensord.conf
@@ -0,0 +1,4 @@
+#
+# Parameters to be passed to sensord
+#
+SENSORD_ARGS=""
diff --git a/abs/extra/lm_sensors/sensord.rc b/abs/extra/lm_sensors/sensord.rc
new file mode 100644
index 0000000..e3ef4d2
--- /dev/null
+++ b/abs/extra/lm_sensors/sensord.rc
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/sensord
+
+PID=$(pidof -o %PPID /usr/sbin/sensord)
+case "$1" in
+ start)
+ stat_busy "Starting sensord"
+ [ -z "$PID" ] && /usr/sbin/sensord ${SENSORD_ARGS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon sensord
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping sensord"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon sensord
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/abs/extra/lm_sensors/sensors-detect.patch b/abs/extra/lm_sensors/sensors-detect.patch
index 981ed3d..1d12a2c 100644
--- a/abs/extra/lm_sensors/sensors-detect.patch
+++ b/abs/extra/lm_sensors/sensors-detect.patch
@@ -1,61 +1,61 @@
---- prog/detect/sensors-detect.orig 2008-02-07 20:59:25.125302226 +0100
-+++ prog/detect/sensors-detect 2008-02-07 21:06:53.821929489 +0100
-@@ -5879,21 +5879,21 @@
- }
- }
+diff -Naur lm_sensors-3.1.0/prog/detect/sensors-detect lm_sensors-3.1.0-new/prog/detect/sensors-detect
+--- lm_sensors-3.1.0/prog/detect/sensors-detect 2009-03-03 20:36:33.000000000 -0500
++++ lm_sensors-3.1.0-new/prog/detect/sensors-detect 2009-03-03 20:52:06.000000000 -0500
+@@ -5282,21 +5282,21 @@
+ }
+ }
-- my $have_sysconfig = -d '/etc/sysconfig';
-- printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
-- (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
-+ my $have_sysconfig = -d '/etc/conf.d';
-+ printf "Do you want to \%s /etc/conf.d/lm_sensors? (\%s): ",
-+ (-e '/etc/conf.d/lm_sensors' ? 'overwrite' : 'generate'),
- ($have_sysconfig ? 'YES/no' : 'yes/NO');
- $_ = <STDIN>;
- if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {
- unless ($have_sysconfig) {
-- mkdir '/etc/sysconfig', 0777
-- or die "Sorry, can't create /etc/sysconfig ($!)";
-+ mkdir '/etc/conf.d', 0777
-+ or die "Sorry, can't create /etc/conf.d ($!)";
- }
-- open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
-- or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
-+ open(local *SYSCONFIG, ">/etc/conf.d/lm_sensors")
-+ or die "Sorry, can't create /etc/conf.d/lm_sensors ($!)";
- print SYSCONFIG <<'EOT';
--# /etc/sysconfig/lm_sensors - Defines modules loaded by
--# /etc/init.d/lm_sensors
-+# /etc/conf.d/lm_sensors - Defines modules loaded by
-+# /etc/rc.d/sensors
- # Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl>
+- my $have_sysconfig = -d '/etc/sysconfig';
+- printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
+- (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
++ my $have_sysconfig = -d '/etc/conf.d';
++ printf "Do you want to \%s /etc/conf.d/lm_sensors? (\%s): ",
++ (-e '/etc/conf.d/lm_sensors' ? 'overwrite' : 'generate'),
+ ($have_sysconfig ? 'YES/no' : 'yes/NO');
+ $_ = <STDIN>;
+ if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {
+ unless ($have_sysconfig) {
+- mkdir('/etc/sysconfig', 0777)
+- or die "Sorry, can't create /etc/sysconfig ($!)";
++ mkdir('/etc/conf.d', 0777)
++ or die "Sorry, can't create /etc/conf.d ($!)";
+ }
+- open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
+- or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
++ open(local *SYSCONFIG, ">/etc/conf.d/lm_sensors")
++ or die "Sorry, can't create /etc/conf.d/lm_sensors ($!)";
+ print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n";
+ print SYSCONFIG <<'EOT';
+-# This file is sourced by /etc/init.d/lm_sensors and defines the modules to
++# This file is sourced by /etc/rc.d/lm_sensors and defines the modules to
+ # be loaded/unloaded.
#
- # This program is free software; you can redistribute it and/or modify
-@@ -5914,8 +5914,8 @@
- # See also the lm_sensors homepage at:
- # http://www.lm-sensors.org/
- #
--# This file is used by /etc/init.d/lm_sensors and defines the modules to
--# be loaded/unloaded. This file is sourced into /etc/init.d/lm_sensors.
-+# This file is used by /etc/rc.d/sensors and defines the modules to
-+# be loaded/unloaded. This file is sourced into /etc/rc.d/sensors.
- #
- # The format of this file is a shell script that simply defines the modules
- # in order as normal variables with the special names:
-@@ -5952,12 +5952,12 @@
- print SYSCONFIG $sysconfig;
- close(SYSCONFIG);
+ # The format of this file is a shell script that simply defines variables:
+@@ -5322,13 +5322,13 @@
+ }
+ close(SYSCONFIG);
+
+- print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
++ print "Copy prog/init/lm_sensors.init to /etc/rc.d/lm_sensors\n".
+ "for initialization at boot time.\n"
+- unless -f "/etc/init.d/lm_sensors";
++ unless -f "/etc/rc.d/lm_sensors";
-- print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
-+ print "Copy prog/init/lm_sensors.init to /etc/rc.d/sensors\n".
- "for initialization at boot time.\n"
-- unless -f "/etc/init.d/lm_sensors";
-+ unless -f "/etc/rc.d/sensors";
+- if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
+- system("/sbin/insserv", "/etc/init.d/lm_sensors");
+- } elsif (-x "/sbin/chkconfig" && -f "/etc/init.d/lm_sensors") {
++ if (-x "/sbin/insserv" && -f "/etc/rc.d/lm_sensors") {
++ system("/sbin/insserv", "/etc/rc.d/lm_sensors");
++ } elsif (-x "/sbin/chkconfig" && -f "/etc/rc.d/lm_sensors") {
+ system("/sbin/chkconfig", "lm_sensors", "on");
+ if (-x "/sbin/service") {
+ system("/sbin/service", "lm_sensors", "start");
+@@ -5377,7 +5377,7 @@
+ exit -1;
+ }
-- if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
-- system("/sbin/insserv", "/etc/init.d/lm_sensors");
-+ if (-x "/sbin/insserv" && -f "/etc/rc.d/sensors") {
-+ system("/sbin/insserv", "/etc/rc.d/sensors");
- } elsif (-x "/sbin/chkconfig" && -f "/etc/init.d/lm_sensors") {
- system("/sbin/chkconfig", "lm_sensors", "on");
- if (-x "/sbin/service") {
+- if (-x "/sbin/service" && -f "/etc/init.d/lm_sensors" &&
++ if (-x "/sbin/service" && -f "/etc/rc.d/sensors" &&
+ -f "/var/lock/subsys/lm_sensors") {
+ system("/sbin/service", "lm_sensors", "stop");
+ }
diff --git a/abs/extra/lm_sensors/sensors.rc b/abs/extra/lm_sensors/sensors.rc
index aa086eb..4acde22 100644
--- a/abs/extra/lm_sensors/sensors.rc
+++ b/abs/extra/lm_sensors/sensors.rc
@@ -1,27 +1,12 @@
#!/bin/bash
-#
-# chkconfig: 2345 26 74
+
# description: sensors is used for monitoring motherboard sensor values.
-# config: /etc/sysconfig/sensors
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# config: /etc/conf.d/lm_sensors
# See also the lm_sensors homepage at:
# http://www2.lm-sensors.nu/~lm78/index.html
-# It uses a config file /etc/sysconfig/sensors that contains the modules to
+# It uses a config file /etc/conf.d/lm_sensors that contains the modules to
# be loaded/unloaded. That file is sourced into this one.
# The format of that file a shell script that simply defines the modules
@@ -31,46 +16,52 @@
. /etc/rc.conf
. /etc/rc.d/functions
-if grep -q sysfs /proc/mounts; then
+PSENSORS=/usr/bin/sensors
+
+if $(grep -q sysfs /proc/mounts); then
WITHSYS=1
else
WITHSYS=0
fi
-CONFIG=/etc/conf.d/lm_sensors
-PSENSORS=/usr/bin/sensors
-if [ ! -x $PSENSORS ]; then
- PSENSORS=/usr/bin/sensors
+if [ $WITHSYS == "0" ]; then
+ # If sensors isn't supported by the kernel, try loading the module...
+ [ -e /proc/sys/dev/sensors ] || /sbin/modprobe i2c-proc &>/dev/null
+
+ # Don't bother if /proc/sensors still doesn't exist, kernel doesn't have support for sensors.
+ if ! [ -e /proc/sys/dev/sensors ]; then
+ echo "lm_sensors: kernel does not have sensors support"
+ stat_fail
+ fi
+
+ # If sensors was not already running, unload the module...
+ [ -e /var/run/daemons/sensors ] || /sbin/modprobe -r i2c-proc &>/dev/null
+fi
+
+if [ -e /etc/conf.d/lm_sensors ]; then
+ CONFIG=/etc/conf.d/lm_sensors
+elif [ -e /etc/sysconfig/lm_sensors ]; then
+ # Moving config to new Arch-specific location
+ mv /etc/sysconfig/lm_sensors /etc/conf.d/lm_sensors
+ CONFIG=/etc/conf.d/lm_sensors
fi
case "$1" in
start)
stat_busy "Starting Up Sensors"
- if [ $WITHSYS == "0" ]; then
- # If sensors isn't supported by the kernel, try loading the module...
- [ -e /proc/sys/dev/sensors ] || /sbin/modprobe i2c-proc &>/dev/null
-
- # Don't bother if /proc/sensors still doesn't exist, kernel doesn't have
- # support for sensors.
- [ -e /proc/sys/dev/sensors ] || exit 0
-
- # If sensors was not already running, unload the module...
- [ -e /var/lock/subsys/lm_sensors ] || /sbin/modprobe -r i2c-proc &>/dev/null
- fi
-
-
if [ -r "$CONFIG" ]; then
- . "$CONFIG"
- modules=`grep \^MODULE_ $CONFIG | wc -l | tr -d ' '`
- i=0
- while [ $i -lt $modules ] ; do
- module=`eval echo '$'MODULE_$i`
- #echo starting module __${module}__ #debug
- /sbin/modprobe $module &>/dev/null
- i=`expr $i + 1`
- done
+ . "$CONFIG"
+ modules=$(grep \^MODULE_ $CONFIG | wc -l | tr -d ' ')
+ i=0
+ while [ $i -lt $modules ] ; do
+ module=$(eval echo '$'MODULE_$i)
+ # echo starting module __${module}__ #debug
+ /sbin/modprobe $module &>/dev/null
+ i=$(expr $i + 1)
+ done
fi
+
$PSENSORS -s
if [ $? -gt 0 ]; then
@@ -85,14 +76,15 @@ case "$1" in
stat_busy "Shutting Down Sensors"
if [ -r "$CONFIG" ]; then
- . "$CONFIG"
- modules=`grep \^MODULE_ $CONFIG | wc -l | tr -d ' '`
- i=`expr $modules`
- while [ $i -ge 0 ] ; do
- module=`eval echo '$'MODULE_$i`
- /sbin/modprobe -r $module &>/dev/null
- i=`expr $i - 1`
- done
+ . "$CONFIG"
+ modules=$(grep \^MODULE_ $CONFIG | wc -l | tr -d ' ')
+ i=$(expr $modules - 1)
+ while [ $i -ge 0 ] ; do
+ module=$(eval echo '$'MODULE_$i)
+ # echo stoping module __${module}__ #debug
+ /sbin/modprobe -r $module &>/dev/null
+ i=$(expr $i - 1)
+ done
fi
if [ $WITHSYS == "0" ]; then
@@ -107,9 +99,8 @@ case "$1" in
fi
;;
- dostatus)
+ status)
$PSENSORS
- RETVAL=$?
;;
restart)
@@ -119,9 +110,10 @@ case "$1" in
;;
condrestart)
- [ -e /var/lock/subsys/lm_sensors ] && restart || :
+ [ -e /var/run/daemons/sensors ] && $0 restart || :
;;
*)
- echo "Usage: sensors.init {start|stop|status|restart|reload|condrestart}"
+ echo "Usage: $0 {start|stop|restart|status|condrestart}"
esac
+exit 0