|
Line
Link Here
|
| 0 |
-- lm_sensors-3.3.1/prog/detect/sensors-detect |
0 |
++ lm_sensors-3.3.1/prog/detect/sensors-detect |
|
Lines 20-25
Link Here
|
| 20 |
# MA 02110-1301 USA. |
20 |
# MA 02110-1301 USA. |
| 21 |
# |
21 |
# |
| 22 |
|
22 |
|
|
|
23 |
# Gentoo specific modifications based on a patch from Rudo Thomas |
| 24 |
# <thomr9am@ss1000.ms.mff.cuni.cz> |
| 25 |
|
| 23 |
require 5.004; |
26 |
require 5.004; |
| 24 |
|
27 |
|
| 25 |
use strict; |
28 |
use strict; |
|
Lines 6471-6496
Link Here
|
| 6471 |
print MODPROBE_D $configfile; |
6474 |
print MODPROBE_D $configfile; |
| 6472 |
close(MODPROBE_D); |
6475 |
close(MODPROBE_D); |
| 6473 |
} else { |
6476 |
} else { |
|
|
6477 |
print "\nIf you want to load the modules at startup, generate a config file\n", |
| 6478 |
"below and make sure lm_sensors gets started at boot time; e.g\n", |
| 6479 |
"\$ rc-update add lm_sensors default\n"; |
| 6474 |
print "To make the sensors modules behave correctly, add these lines to\n". |
6480 |
print "To make the sensors modules behave correctly, add these lines to\n". |
| 6475 |
"/etc/modprobe.conf:\n\n"; |
6481 |
"/etc/modules.d/lm_sensors and run modules-update:\n\n"; |
| 6476 |
print "#----cut here----\n". |
6482 |
print "#----cut here----\n". |
| 6477 |
$configfile. |
6483 |
$configfile. |
| 6478 |
"#----cut here----\n\n"; |
6484 |
"#----cut here----\n\n"; |
| 6479 |
} |
6485 |
} |
| 6480 |
} |
6486 |
} |
| 6481 |
|
6487 |
|
| 6482 |
my $have_sysconfig = -d '/etc/sysconfig'; |
6488 |
my $have_config = -f '/etc/conf.d/lm_sensors'; |
| 6483 |
printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ", |
6489 |
print "\nDo you want to ".($have_config?"overwrite":"generate"). |
| 6484 |
(-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'), |
6490 |
" /etc/conf.d/lm_sensors? Enter s to specify other file name?\n", |
| 6485 |
($have_sysconfig ? 'YES/no' : 'yes/NO'); |
6491 |
" (".($have_config?"yes/NO":"YES/no")."/s): "; |
| 6486 |
$_ = <STDIN>; |
6492 |
my $reply = <STDIN>; |
| 6487 |
if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) { |
6493 |
|
| 6488 |
unless ($have_sysconfig) { |
6494 |
if (($have_config and $reply =~ /^\s*[Yy]/) or |
| 6489 |
mkdir('/etc/sysconfig', 0777) |
6495 |
(not $have_config and not $reply =~ /^\s*[Nn]/) or |
| 6490 |
or die "Sorry, can't create /etc/sysconfig ($!)"; |
6496 |
$reply =~ /^\s*[Ss]/) { |
|
|
6497 |
my $filename = "/etc/conf.d/lm_sensors"; |
| 6498 |
if ($reply =~ /^\s*[Ss]/) { |
| 6499 |
print "Specify the file to store the configuration to: "; |
| 6500 |
$filename = <STDIN>; |
| 6491 |
} |
6501 |
} |
| 6492 |
open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors") |
6502 |
open(local *SYSCONFIG, ">".$filename) |
| 6493 |
or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)"; |
6503 |
or die "Sorry, can't create $filename ($!)."; |
| 6494 |
print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n"; |
6504 |
print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n"; |
| 6495 |
print SYSCONFIG <<'EOT'; |
6505 |
print SYSCONFIG <<'EOT'; |
| 6496 |
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to |
6506 |
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to |
|
Lines 6501-6506
Link Here
|
| 6501 |
# BUS_MODULES for any required bus driver module (for example for I2C or SPI). |
6511 |
# BUS_MODULES for any required bus driver module (for example for I2C or SPI). |
| 6502 |
|
6512 |
|
| 6503 |
EOT |
6513 |
EOT |
|
|
6514 |
print SYSCONFIG |
| 6515 |
"# Load modules at startup\n". |
| 6516 |
"LOADMODULES=yes\n\n". |
| 6517 |
"# Initialize sensors at startup\n". |
| 6518 |
"INITSENSORS=yes\n\n"; |
| 6504 |
print SYSCONFIG "BUS_MODULES=\"", join(" ", @{$bus_modules}), "\"\n" |
6519 |
print SYSCONFIG "BUS_MODULES=\"", join(" ", @{$bus_modules}), "\"\n" |
| 6505 |
if @{$bus_modules}; |
6520 |
if @{$bus_modules}; |
| 6506 |
print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n"; |
6521 |
print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n"; |
|
Lines 6509-6514
Link Here
|
| 6509 |
|
6524 |
|
| 6510 |
# For compatibility reasons, modules are also listed individually as variables |
6525 |
# For compatibility reasons, modules are also listed individually as variables |
| 6511 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
6526 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
|
|
6527 |
# Please note that the numbers in MODULE_X must start at 0 and increase in |
| 6528 |
# steps of 1. Any number that is missing will make the init script skip the |
| 6529 |
# rest of the modules. Use MODULE_X_ARGS for arguments. |
| 6530 |
# |
| 6512 |
# You should use BUS_MODULES and HWMON_MODULES instead if possible. |
6531 |
# You should use BUS_MODULES and HWMON_MODULES instead if possible. |
| 6513 |
|
6532 |
|
| 6514 |
EOT |
6533 |
EOT |
|
Lines 6519-6543
Link Here
|
| 6519 |
} |
6538 |
} |
| 6520 |
close(SYSCONFIG); |
6539 |
close(SYSCONFIG); |
| 6521 |
|
6540 |
|
| 6522 |
if (-x "/bin/systemctl" && -d "/lib/systemd/system" && |
6541 |
print "Done.\n"; |
| 6523 |
! -f "/lib/systemd/system/lm_sensors.service") { |
|
|
| 6524 |
print "Copy prog/init/lm_sensors.service to /lib/systemd/system\n". |
| 6525 |
"and run 'systemctl enable lm_sensors.service'\n". |
| 6526 |
"for initialization at boot time.\n"; |
| 6527 |
return; |
| 6528 |
} |
| 6529 |
|
| 6530 |
if (-x "/bin/systemctl" && |
| 6531 |
-f "/lib/systemd/system/lm_sensors.service") { |
| 6532 |
system("/bin/systemctl", "enable", "lm_sensors.service"); |
| 6533 |
system("/bin/systemctl", "start", "lm_sensors.service"); |
| 6534 |
# All done, don't check for /etc/init.d/lm_sensors |
| 6535 |
return; |
| 6536 |
} |
| 6537 |
|
| 6538 |
print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n". |
| 6539 |
"for initialization at boot time.\n" |
| 6540 |
unless -f "/etc/init.d/lm_sensors"; |
| 6541 |
|
6542 |
|
| 6542 |
if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") { |
6543 |
if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") { |
| 6543 |
system("/sbin/insserv", "/etc/init.d/lm_sensors"); |
6544 |
system("/sbin/insserv", "/etc/init.d/lm_sensors"); |
|
Lines 6551-6570
Link Here
|
| 6551 |
"kernel modules.\n\n"; |
6552 |
"kernel modules.\n\n"; |
| 6552 |
} |
6553 |
} |
| 6553 |
} else { |
6554 |
} else { |
| 6554 |
print "To load everything that is needed, add this to one of the system\n". |
|
|
| 6555 |
"initialization scripts (e.g. /etc/rc.d/rc.local):\n\n"; |
| 6556 |
print "#----cut here----\n"; |
| 6557 |
if (@{$bus_modules}) { |
| 6558 |
print "# Adapter drivers\n"; |
| 6559 |
print "modprobe $_\n" foreach (@{$bus_modules}); |
| 6560 |
} |
| 6561 |
print "# Chip drivers\n"; |
| 6562 |
print "modprobe $_\n" foreach (@{$hwmon_modules}); |
| 6563 |
print((-e '/usr/bin/sensors' ? |
| 6564 |
"/usr/bin/sensors -s\n" : |
| 6565 |
"/usr/local/bin/sensors -s\n"). |
| 6566 |
"#----cut here----\n\n"); |
| 6567 |
|
| 6568 |
print "If you have some drivers built into your kernel, the list above will\n". |
6555 |
print "If you have some drivers built into your kernel, the list above will\n". |
| 6569 |
"contain too many modules. Skip the appropriate ones! You really\n". |
6556 |
"contain too many modules. Skip the appropriate ones! You really\n". |
| 6570 |
"should try these commands right now to make sure everything is\n". |
6557 |
"should try these commands right now to make sure everything is\n". |