121 lines
4.6 KiB
Diff
121 lines
4.6 KiB
Diff
--- prog/detect/sensors-detect.orig 2010-01-12 17:07:22.231802699 +0100
|
|
+++ prog/detect/sensors-detect 2010-01-12 17:12:34.880680773 +0100
|
|
@@ -5421,9 +5421,8 @@ sub write_config
|
|
{
|
|
my ($configfile, $bus_modules, $hwmon_modules) = @_;
|
|
|
|
- if (defined $configfile) {
|
|
my $have_modprobe_d = -d '/etc/modprobe.d';
|
|
- printf "Do you want to \%s /etc/modprobe.d/lm_sensors? (\%s): ",
|
|
+ printf "Do you want to \%s /etc/modprobe.d/lm_sensors.conf? (\%s): ",
|
|
(-e '/etc/modprobe.d/lm_sensors' ? 'overwrite' : 'generate'),
|
|
($have_modprobe_d ? 'YES/no' : 'yes/NO');
|
|
$_ = <STDIN>;
|
|
@@ -5432,97 +5431,25 @@ sub write_config
|
|
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 ($!)";
|
|
+ open(local *MODPROBE_D, ">/etc/modprobe.d/lm_sensors.conf")
|
|
+ or die "Sorry, can't create /etc/modprobe.d/lm_sensors.conf ($!)";
|
|
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".
|
|
- "/etc/modprobe.conf:\n\n";
|
|
- print "#----cut here----\n".
|
|
- $configfile.
|
|
- "#----cut here----\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'),
|
|
- ($have_sysconfig ? 'YES/no' : 'yes/NO');
|
|
- $_ = <STDIN>;
|
|
- if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {
|
|
- unless ($have_sysconfig) {
|
|
- mkdir('/etc/sysconfig', 0777)
|
|
- or die "Sorry, can't create /etc/sysconfig ($!)";
|
|
- }
|
|
- open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
|
|
- or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
|
|
- print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n";
|
|
- print SYSCONFIG <<'EOT';
|
|
-# This file is sourced by /etc/init.d/lm_sensors and defines the modules to
|
|
-# be loaded/unloaded.
|
|
-#
|
|
-# The format of this file is a shell script that simply defines variables:
|
|
-# HWMON_MODULES for hardware monitoring driver modules, and optionally
|
|
-# BUS_MODULES for any required bus driver module (for example for I2C or SPI).
|
|
-
|
|
-EOT
|
|
- print SYSCONFIG "BUS_MODULES=\"", join(" ", @{$bus_modules}), "\"\n"
|
|
- if @{$bus_modules};
|
|
- print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n";
|
|
-
|
|
- print SYSCONFIG <<'EOT';
|
|
-
|
|
-# For compatibility reasons, modules are also listed individually as variables
|
|
-# MODULE_0, MODULE_1, MODULE_2, etc.
|
|
-# You should use BUS_MODULES and HWMON_MODULES instead if possible.
|
|
-
|
|
-EOT
|
|
- my $i = 0;
|
|
- foreach (@{$bus_modules}, @{$hwmon_modules}) {
|
|
- print SYSCONFIG "MODULE_$i=$_\n";
|
|
- $i++;
|
|
- }
|
|
- 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";
|
|
-
|
|
- if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
|
|
- system("/sbin/insserv", "/etc/init.d/lm_sensors");
|
|
- } elsif (-x "/sbin/chkconfig" && -f "/etc/init.d/lm_sensors") {
|
|
- system("/sbin/chkconfig", "lm_sensors", "on");
|
|
- if (-x "/sbin/service") {
|
|
- system("/sbin/service", "lm_sensors", "start");
|
|
- }
|
|
- } else {
|
|
- 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 one of the system\n".
|
|
- "initialization scripts (e.g. /etc/rc.d/rc.local):\n\n";
|
|
- print "#----cut here----\n";
|
|
+ print MODPROBE_D;
|
|
if (@{$bus_modules}) {
|
|
- print "# Adapter drivers\n";
|
|
- print "modprobe $_\n" foreach (@{$bus_modules});
|
|
+ print MODPROBE_D "# Adapter drivers\n";
|
|
+ print MODPROBE_D "modprobe $_\n" foreach (@{$bus_modules});
|
|
+ }
|
|
+ print MODPROBE_D "# Chip drivers\n";
|
|
+ print MODPROBE_D "modprobe $_\n" foreach (@{$hwmon_modules});
|
|
+ close(MODPROBE_D);
|
|
}
|
|
- print "# Chip drivers\n";
|
|
- print "modprobe $_\n" foreach (@{$hwmon_modules});
|
|
- print((-e '/usr/bin/sensors' ?
|
|
- "/usr/bin/sensors -s\n" :
|
|
- "/usr/local/bin/sensors -s\n").
|
|
- "#----cut here----\n\n");
|
|
|
|
+ print "\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";
|
|
- }
|
|
-
|
|
}
|
|
|
|
sub main
|