prog/init/lm_sensors.init: reduce verbosity, MAKEDEV, usage and
Hi,
Quoted 9 lines · Jean Delvare
Quoted 6 lines
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_sensorsunconfigured systems.Sounds sane to me.
Quoted 8 lines
Quoted 2 lines
There is also a MAKEDEV in the start command. This may be required for proper udev operation.
Doesn't sound good to me. For one thing not all systems may have
/sbin/MAKEDEV, for another what is fine for udev might not be fine for devfs or static /dev systems. Also, I thought that udev was totally dynamic so I don't understand why we would have to create the device files.
I've tested this and the devices do not get created. Do the i2c modules create hotplug events for udev to pick them up? Or perhaps there are udev rules required for i2c modules. Running sensors-detect does creates /dev/i2c-0.
Quoted 2 lines
Last,
/dev/i2c*files are not needed for proper operation of the hardware monitoring modules, only for sensors-detect and dump tools.
It would be nicer to have the modules advertise their /dev interfaces, so other tools can see them. Otherwise each tools would haveto generate the /dev entries itself.
Quoted 5 lines
CONFIG=/etc/sysconfig/lm_sensors
+[ -r "$CONFIG" ] || exit 0
+egrep '^MODULE_' $CONFIG &>/dev/null || exit 0Why egrep and not simply grep?
Taken over w/o much though, grep would be fine.
Quoted 1 line
I'd also suggest -q instead of &>/dev/null.
Best would be
grep '^MODULE_' $CONFIG >/dev/null 2>&1
From grep's doc:
Quoted 9 lines
Portability note: unlike GNU
grep', traditionalgrep' did not conform to POSIX.2, because traditionalgrep' lacked a-q' option and its-s' option behaved like GNUgrep''s-q' option. Shell scripts intended to be portable to traditionalgrep' should avoid both-q' and-s' and should redirect output to `/dev/null' instead.BTW, what's the difference between ">" and "&>"? The latter is not documented in my sh man page (">&" is).
It's bash's shortcut version of 2>&1, I think. Better have the sh version as above.
Quoted 5 lines
(quoted diff) +1
-2- echo -n $"Starting up sensors: " - test -r "$CONFIG" && . "$CONFIG" + echo -n $"Starting $prog: starting module "What is the leading $ for, BTW?
Bash's "locale-specific translation of the characters between the double quotes".
Quoted 7 lines
Quoted 1 line
From a technical point of view, we are not starting modules, but loading
them.
(quoted diff) +1
-1- echo starting module __${module}__ + echo -n "__${module}__ "Do we need these extra underscores at all? Looks ugly IMHO.
I'd also like to remove them.
Signature · 8 lines
Axel.Thimm at ATrpms.net -------------- 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/0dde7915/attachment.bin
Quoted 7 lines · Jean Delvare
The names you pick are confusing. Bus drivers are modules too. BUSES and CHIPS would be better.
Agreed. However, I wonder why things were done that way in the first place. Were we following some Red Hat standard? I have no Red Hat-like system to verify that. If there is no standard to follow, any code simplification is welcome.
Don't know about history, but currently Red Hat uses this format.
Signature · 8 lines
Axel.Thimm at ATrpms.net -------------- 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/09792346/attachment.bin
Hi Axel,
Quoted 3 lines
I've tested this and the devices do not get created. Do the i2c modules create hotplug events for udev to pick them up? Or perhaps there are udev rules required for i2c modules.
Frankly I don't know how udev works, nor do I use it. I can't say.
Quoted 1 line
Running sensors-detect does creates
/dev/i2c-0.
More likely, loading one i2c bus driver (and possibly i2c-dev) created it.
Quoted 3 lines
It would be nicer to have the modules advertise their /dev interfaces, so other tools can see them. Otherwise each tools would haveto generate the /dev entries itself.
This is how things work. Either there is a static /dev tree and files are created once and for all, or devfs/udev are used and device files should be created dynamically by either devfsd or udev. Thus I see no room for the /sbin/MAKEDEV thing you found in Red Hat's init file.
Quoted 11 lines
Best would be
grep '^MODULE_' $CONFIG >/dev/null 2>&1
From grep's doc:
Quoted 6 lines
Portability note: unlike GNU
grep', traditionalgrep' did not conform to POSIX.2, because traditionalgrep' lacked a-q' option and its-s' option behaved like GNUgrep''s-q' option. Shell scripts intended to be portable to traditionalgrep' should avoid both-q' and-s' and should redirect output to `/dev/null' instead.
Well, lm_sensors only works on Linux and Linux systems have GNU grep. There is no portability issue that I can think of. Either will be fine though, it doesn't really matter.
Quoted 8 lines
Quoted 5 lines
(quoted diff) +1
-2- echo -n $"Starting up sensors: " - test -r "$CONFIG" && . "$CONFIG" + echo -n $"Starting $prog: starting module "What is the leading $ for, BTW?
Bash's "locale-specific translation of the characters between the double quotes".
But it's an sh script.
Please provide an updated version of your patch if you want us to apply it.
Thanks,
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/