From b1df5b653650e1e81ec43a2912b3517f9b34174a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 12 Jan 2009 16:17:51 +0000 Subject: [PATCH] Print warnings about missing modules on screen, rather than telling the user to add them to the configuration files. When using the sysconfig integration mode, the warnings would never be seen. Also don't include missing modules in the configuration files, as they may cause the lm_sensors service to fail. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5590 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 3e7405b0..a0bc5586 100644 --- a/CHANGES +++ b/CHANGES @@ -54,6 +54,7 @@ SVN-HEAD Add Winbond/Nuvoton W83667HG support Add Intel Core I7 support Generate new format for /etc/sysconfig/lm_sensors + Print warnings about missing modules on screen sensors-detect-stat.pl: Delete (functionality merged into sensors-detect) 3.0.3 (2008-09-28) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 4bf2b444..95b33ae7 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -5117,7 +5117,6 @@ sub generate_modprobes $bus_modules{"i2c-isa"}++; } if ($ipmi) { - $modprobes .= "# You must also install and load the IPMI modules\n"; $modprobes .= "modprobe ipmi-si\n"; $bus_modules{"ipmi-si"}++; } @@ -5127,7 +5126,8 @@ sub generate_modprobes foreach $driver (keys %chips_detected) { next if not @{$chips_detected{$driver}}; if ($driver eq "to-be-written") { - $modprobes .= "# no driver for ${$chips_detected{$driver}}[0]{chipname} yet\n"; + print "Note: there is no driver for ${$chips_detected{$driver}}[0]{chipname} yet.\n". + "Check http://www.lm-sensors.org/wiki/Devices for updates.\n\n"; } else { open(local *INPUTFILE, "modprobe -l $driver 2>/dev/null |"); local $_; @@ -5142,13 +5142,14 @@ sub generate_modprobes # Check return value from modprobe in case modprobe -l # isn't supported if ((($? >> 8) == 0) && ! $modulefound) { - $modprobes .= "# Warning: the required module $driver is not currently installed\n". - "# on your system. For status of 2.6 kernel ports check\n". - "# http://www.lm-sensors.org/wiki/Devices. If driver is built\n". - "# into the kernel, or unavailable, comment out the following line.\n"; + print "Warning: the required module $driver is not currently installed\n". + "on your system. If it is built into the kernel then it's OK.\n". + "Otherwise, check http://www.lm-sensors.org/wiki/Devices for\n". + "driver availability.\n\n"; + } else { + $modprobes .= "modprobe $driver\n"; + $hwmon_modules{$driver}++; } - $modprobes .= "modprobe $driver\n"; - $hwmon_modules{$driver}++; } } @@ -5408,7 +5409,12 @@ sub main print "\n"; my ($modprobes, $configfile, $bus_modules, $hwmon_modules) = generate_modprobes(); - write_config($modprobes, $configfile, $bus_modules, $hwmon_modules); + + if (@{$hwmon_modules}) { + write_config($modprobes, $configfile, $bus_modules, $hwmon_modules); + } else { + print "No modules to load, skipping modules configuration.\n\n"; + } unload_modules(); }