Improve sysconfig and modprobe.d integration, based on suggestions by

Gary Funck:
* If we create /etc/sysconfig/lm_sensors, there's no point in printing
  the modprobe commands on the screen.
* Otherwise, suggest /etc/rc.d/rc.local as the init script where to put
  the commands.
* If /etc/modprobe.d exists, create a file there to store the module
  options, rather than printing them on the screen.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5081 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-12-18 13:08:34 +00:00
1 parent a6cb801017
commit 8ddd513188
2 files changed
+46 -26

No files matched your search

+3 -1
View File
@@ -28,7 +28,9 @@ SVN-HEAD
Add SMSC LPC47B367-NC detection (no sensors)
Reduce w83781d/lm78 I2C address probing range
Drop PCA9540 detection
Add Intel Celeron 4xx and Penryn (CPU on 45nm) detection
Add Intel Celeron 4xx and Penryn (CPU on 45nm)
detection
Improve sysconfig and modprobe.d integration
2.10.5 (20071024)
File i2c-dev.h: Rename I2C_FUNC_SMBUS_HWPEC_CALC to I2C_FUNC_SMBUS_PEC
+43 -25
View File
@@ -5834,35 +5834,34 @@ sub main
}
print "\n";
print "I will now generate the commands needed to load the required modules.\n".
"Just press ENTER to continue: ";
<STDIN>;
print "\n";
my ($modprobes, $configfile) = generate_modprobes 1; # 1 == prefer ISA
if (defined $configfile) {
print "To make the sensors modules behave correctly, add these lines to\n".
"$modules_conf:\n\n";
print "#----cut here----\n".
$configfile.
"#----cut here----\n\n";
my $have_modprobe_d = -d '/etc/modprobe.d';
printf "Do you want to \%s /etc/modprobe.d/lm_sensors? (\%s): ",
(-e '/etc/modprobe.d/lm_sensors' ? 'overwrite' : 'generate'),
($have_modprobe_d ? 'YES/no' : 'yes/NO');
$_ = <STDIN>;
if (($have_modprobe_d and not m/^\s*n/i) or m/^\s*y/i) {
unless ($have_modprobe_d) {
mkdir '/etc/modprobe.d', 0777
or die "Sorry, can't create /etc/modprobe.d ($!)";
}
open(local *MODPROBE_D, ">/etc/modprobe.d/lm_sensors")
or die "Sorry, can't create /etc/modprobe.d/lm_sensors ($!)";
print MODPROBE_D
"# Generated by sensors-detect on " . scalar localtime() . "\n";
print MODPROBE_D $configfile;
close(MODPROBE_D);
} else {
print "To make the sensors modules behave correctly, add these lines to\n".
"$modules_conf:\n\n";
print "#----cut here----\n".
$configfile.
"#----cut here----\n\n";
}
}
print "To load everything that is needed, add this to some /etc/rc* file:\n\n";
print "#----cut here----\n".
$modprobes.
"# sleep 2 # optional\n".
(-e '/usr/bin/sensors' ?
"/usr/bin/sensors -s # recommended\n" :
"/usr/local/bin/sensors -s # recommended\n") .
"#----cut here----\n\n";
print "If you have some drivers built into your kernel, the list above will\n".
"contain too many modules. Skip the appropriate ones! You really\n".
"should try these commands right now to make sure everything is\n".
"working properly. Monitoring programs won't work until the needed\n".
"modules are loaded.\n\n";
my $have_sysconfig = -d '/etc/sysconfig';
printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
(-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
@@ -5919,10 +5918,29 @@ EOT
$i++;
}
print SYSCONFIG $sysconfig;
close(SYSCONFIG);
print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
"for initialization at boot time.\n"
unless -f "/etc/init.d/lm_sensors";
print "You should now start the lm_sensors service to load the required\n".
"kernel modules.\n\n";
} else {
print "To load everything that is needed, add this to e.g. /etc/rc.d/rc.local:\n\n";
print "#----cut here----\n".
$modprobes.
"# sleep 2 # optional\n".
(-e '/usr/bin/sensors' ?
"/usr/bin/sensors -s # recommended\n" :
"/usr/local/bin/sensors -s # recommended\n") .
"#----cut here----\n\n";
print "If you have some drivers built into your kernel, the list above will\n".
"contain too many modules. Skip the appropriate ones! You really\n".
"should try these commands right now to make sure everything is\n".
"working properly. Monitoring programs won't work until the needed\n".
"modules are loaded.\n\n";
}
}