[PATCH] prog/init/lm_sensors.init: reduce verbosity, MAKEDEV, usage and other minor cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).
-- 
Axel.Thimm at ATrpms.net
-------------- next part --------------
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
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20041207/65d50703/attachment.bin 


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux