mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 14:25:39 +00:00
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/branches/lm-sensors-3.0.0@5080 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user