This patch has me thinking... What do people think about changing the format of the sysconfig/lm_sensors config file from MODULE_0=i2c-i801 MODULE_1=i2c-isa MODULE_2=lm85 MODULE_3=eeprom MODULE_4=w83781d to BUSES="i2c-i801 i2c-isa" MODULES="lm85 eeprom w83781d" If we did this, then we could get rid of the confusing and obscure backticks and eval in the module loading loop, replacing it with something simple like: for module in $MODULES ; do echo -n __$module__ modprobe $module done Which seems much clearer to me. This would also mean that users would no longer have to edit variable names to keep them sequential when adding, removing or re-ordering modules. If I hear agreement, I'll work up a patch. We'll need to modify sensors-detect to generate the new format. :v) Axel Thimm wrote: >Hi, > >the attached patch is partly including some patching by Red Hat, which >are distribution independent. > >It exits early on absence of config files, or empty config files (no >MODULE_* entries) to avoid noise at startup of lm_sensors unconfigured >systems. > >There is also a MAKEDEV in the start command. This may be required for >proper udev operation. > >It also fixes a couple of minor other things like to output of the >usage ($0 instead of fixed "sensors.init" etc). > > >------------------------------------------------------------------------ > >Index: prog/init/lm_sensors.init >=================================================================== >RCS file: /home/cvs/lm_sensors2/prog/init/lm_sensors.init,v >retrieving revision 1.6 >diff -u -d -r1.6 lm_sensors.init >--- prog/init/lm_sensors.init 27 Nov 2004 04:24:41 -0000 1.6 >+++ prog/init/lm_sensors.init 7 Dec 2004 01:47:20 -0000 >@@ -47,6 +47,12 @@ > fi > > CONFIG=/etc/sysconfig/lm_sensors >+[ -r "$CONFIG" ] || exit 0 >+egrep '^MODULE_' $CONFIG &>/dev/null || exit 0 >+ >+# Load config file >+. "$CONFIG" >+ > PSENSORS=/usr/local/bin/sensors > > if [ ! -x $PSENSORS ]; then >@@ -57,16 +63,17 @@ > . /etc/init.d/functions > > RETVAL=0 >+prog="lm_sensors" > > start() { >- echo -n $"Starting up sensors: " >- test -r "$CONFIG" && . "$CONFIG" >+ echo -n $"Starting $prog: starting module " > >+ /sbin/MAKEDEV i2c > modules=`grep \^MODULE_ $CONFIG | wc -l | tr -d ' '` > i=0 > while [ $i -lt $modules ] ; do > module=`eval echo '$'MODULE_$i` >- echo starting module __${module}__ >+ echo -n "__${module}__ " > /sbin/modprobe $module &>/dev/null > i=`expr $i + 1` > done >@@ -83,8 +90,7 @@ > } > > stop() { >- echo -n $"Shutting down sensors: " >- test -r "$CONFIG" && . "$CONFIG" >+ echo -n $"Stopping $prog: " > > modules=`grep \^MODULE_ $CONFIG | wc -l | tr -d ' '` > i=`expr $modules` >@@ -141,7 +147,7 @@ > condrestart > ;; > *) >- echo "Usage: sensors.init {start|stop|status|restart|reload|condrestart}" >+ echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" > exit 1 > esac > > > -- Philip Pokorny, Director of Engineering Tel: 415-954-2823 Fax: 415-954-2899 Toll Free: 888-PENGUIN PENGUIN COMPUTING, INC. www.penguincomputing.com