summaryrefslogtreecommitdiffstats
path: root/abs/extra/lm_sensors/sensors.rc
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/sensors.rc
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/sensors.rc')
-rw-r--r--abs/extra/lm_sensors/sensors.rc106
1 files changed, 49 insertions, 57 deletions
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