From 8cb89a13a5f918276f49a493455ab64776419932 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 14 Oct 2004 13:39:28 +0000 Subject: [PATCH] - added initial /etc/sysconfig/lm_sensors - added initscript - MAKEDEV the initial i2c devices in initscript and sensors-detect --- lm_sensors-2.8.7-udev.patch | 13 ++++ lm_sensors.init | 134 ++++++++++++++++++++++++++++++++++++ lm_sensors.spec | 15 ++++ lm_sensors.sysconfig | 2 + 4 files changed, 164 insertions(+) create mode 100644 lm_sensors-2.8.7-udev.patch create mode 100755 lm_sensors.init create mode 100644 lm_sensors.sysconfig diff --git a/lm_sensors-2.8.7-udev.patch b/lm_sensors-2.8.7-udev.patch new file mode 100644 index 0000000..4ab0868 --- /dev/null +++ b/lm_sensors-2.8.7-udev.patch @@ -0,0 +1,13 @@ +--- lm_sensors-2.8.7/prog/detect/sensors-detect.udev 2004-10-14 15:32:12.486908800 +0200 ++++ lm_sensors-2.8.7/prog/detect/sensors-detect 2004-10-14 15:35:32.910911461 +0200 +@@ -1788,8 +1788,8 @@ + if (-c '/dev/i2c-0') { + $dev_i2c = '/dev/i2c-'; + } else { # default +- print "No i2c device files found. Use prog/mkdev/mkdev.sh to create them.\n"; +- exit -1; ++ system("/sbin/MAKEDEV i2c"); ++ $dev_i2c = '/dev/i2c-'; + } + } + } diff --git a/lm_sensors.init b/lm_sensors.init new file mode 100755 index 0000000..ef7e7cb --- /dev/null +++ b/lm_sensors.init @@ -0,0 +1,134 @@ +#!/bin/sh +# +# 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. + +# 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 +# be loaded/unloaded. That file is sourced into this one. + +# The format of that file a shell script that simply defines the modules +# in order as normal shell variables with the special names: +# MODULE_1, MODULE_2, MODULE_3, etc. + +# If sensors isn't supported by the kernel, try loading the module... +[ -e /sys/bus/i2c ] || /sbin/modprobe i2c-dev &>/dev/null + +[ -e /sys/bus/i2c ] || sleep 1 + +# Don't bother if /sys/bus/i2c still doesn't exist, kernel doesn't have +# support for sensors. +[ -e /sys/bus/i2c ] || exit 0 + +CONFIG=/etc/sysconfig/lm_sensors + +[ -r "$CONFIG" ] || exit 0 +egrep '^MODULE_' $CONFIG &>/dev/null || exit 0 + +PSENSORS=/usr/bin/sensors + +# Source function library. +. /etc/init.d/functions + +RETVAL=0 +prog="sensors" + +start() { + echo -n $"Starting $prog: " + + modules=`grep \^MODULE_ $CONFIG | wc -l | tr -d ' '` + i=0 + while [ $i -lt $modules ] ; do + module=`eval echo '$'MODULE_$i` +# echo starting module __${module}__ + /sbin/modprobe $module &>/dev/null + i=`expr $i + 1` + done + $PSENSORS -s + + RETVAL=$? + if [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sensors ; then + echo_success + echo + else + echo_failure + echo + fi +} + +stop() { + echo -n $"Stopping $prog: " + + 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 + + RETVAL=$? + if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sensors ; then + echo_success + echo + else + echo_failure + echo + fi +} + +dostatus() { + $PSENSORS + RETVAL=$? +} + +restart() { + stop + start + RETVAL=$? +} + +condrestart() { + [ -e /var/lock/subsys/sensors ] && restart || : +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + dostatus + ;; + restart|reload) + restart + ;; + condrestart) + condrestart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart}" + exit 1 +esac + +exit $RETVAL diff --git a/lm_sensors.spec b/lm_sensors.spec index 5bd6fd6..363af1e 100644 --- a/lm_sensors.spec +++ b/lm_sensors.spec @@ -3,12 +3,15 @@ Version: 2.8.7 Release: 1 URL: http://secure.netroedge.com/~lm78/ Source: http://secure.netroedge.com/~lm78/archive/lm_sensors-%{version}.tar.gz +Source1: lm_sensors.sysconfig +Source2: lm_sensors.init Patch1: lm_sensors-2.5.5-glibc22.patch Patch2: lm_sensors-2.8.3-redhat.patch Patch3: lm_sensors-2.8.0-utf8.patch Patch4: lm_sensors-2.8.2-expr.patch Patch5: lm_sensors-2.8.3-local.patch Patch6: lm_sensors-2.8.3-rpath.patch +Patch7: lm_sensors-2.8.7-udev.patch Summary: Hardware monitoring tools. Group: Applications/System License: GPL @@ -39,6 +42,7 @@ when building applications that make use of sensor data. %patch4 -p1 -b .expr %patch5 -p1 -b .local %patch6 -p1 -b .rpath +%patch7 -p1 -b .udev %build mkdir -p kernel/include/linux @@ -57,6 +61,10 @@ mv prog/init/README prog/init/README.initscripts # Remove userland kernel headers, belong in glibc-kernheaders. rm -rf $RPM_BUILD_ROOT%{_includedir}/linux +install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/lm_sensors +mkdir -p $RPM_BUILD_ROOT%{_initrddir} +install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/lm_sensors + %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT @@ -72,6 +80,8 @@ rm -rf $RPM_BUILD_ROOT%{_includedir}/linux %{_libdir}/*.so.* %{_mandir}/man*/* %{_sbindir}/* +%config %{_initrddir}/lm_sensors +%config %{_sysconfdir}/sysconfig/lm_sensors %files devel %defattr(-,root,root) @@ -80,6 +90,11 @@ rm -rf $RPM_BUILD_ROOT%{_includedir}/linux %{_libdir}/lib*.so %changelog +* Thu Oct 14 2004 Harald Hoyer 2.8.7-2 +- added initial /etc/sysconfig/lm_sensors +- added initscript +- MAKEDEV the initial i2c devices in initscript and sensors-detect + * Tue Jul 06 2004 Phil Knirsch 2.8.7-1 - Update to latest upstream version. diff --git a/lm_sensors.sysconfig b/lm_sensors.sysconfig new file mode 100644 index 0000000..c1b5809 --- /dev/null +++ b/lm_sensors.sysconfig @@ -0,0 +1,2 @@ +# /etc/sysconfig/sensors - Defines modules loaded by /etc/rc.d/init.d/lm_sensors +# Run sensors-detect to generate this config file