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 5274-5299
Link Here
|
5274 |
print MODPROBE_D $configfile; |
5277 |
print MODPROBE_D $configfile; |
5275 |
close(MODPROBE_D); |
5278 |
close(MODPROBE_D); |
5276 |
} else { |
5279 |
} else { |
|
|
5280 |
print "\nIf you want to load the modules at startup, generate a config file\n", |
5281 |
"below and make sure lm_sensors gets started at boot time; e.g\n", |
5282 |
"\$ rc-update add lm_sensors default\n"; |
5277 |
print "To make the sensors modules behave correctly, add these lines to\n". |
5283 |
print "To make the sensors modules behave correctly, add these lines to\n". |
5278 |
"/etc/modprobe.conf:\n\n"; |
5284 |
"/etc/modules.d/lm_sensors and run modules-update:\n\n"; |
5279 |
print "#----cut here----\n". |
5285 |
print "#----cut here----\n". |
5280 |
$configfile. |
5286 |
$configfile. |
5281 |
"#----cut here----\n\n"; |
5287 |
"#----cut here----\n\n"; |
5282 |
} |
5288 |
} |
5283 |
} |
5289 |
} |
5284 |
|
5290 |
|
5285 |
my $have_sysconfig = -d '/etc/sysconfig'; |
5291 |
my $have_config = -f '/etc/conf.d/lm_sensors'; |
5286 |
printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ", |
5292 |
print "\nDo you want to ".($have_config?"overwrite":"generate"). |
5287 |
(-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'), |
5293 |
" /etc/conf.d/lm_sensors? Enter s to specify other file name?\n", |
5288 |
($have_sysconfig ? 'YES/no' : 'yes/NO'); |
5294 |
" (".($have_config?"yes/NO":"YES/no")."/s): "; |
5289 |
$_ = <STDIN>; |
5295 |
my $reply = <STDIN>; |
5290 |
if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) { |
5296 |
|
5291 |
unless ($have_sysconfig) { |
5297 |
if (($have_config and $reply =~ /^\s*[Yy]/) or |
5292 |
mkdir('/etc/sysconfig', 0777) |
5298 |
(not $have_config and not $reply =~ /^\s*[Nn]/) or |
5293 |
or die "Sorry, can't create /etc/sysconfig ($!)"; |
5299 |
$reply =~ /^\s*[Ss]/) { |
|
|
5300 |
my $filename = "/etc/conf.d/lm_sensors"; |
5301 |
if ($reply =~ /^\s*[Ss]/) { |
5302 |
print "Specify the file to store the configuration to: "; |
5303 |
$filename = <STDIN>; |
5294 |
} |
5304 |
} |
5295 |
open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors") |
5305 |
open(SYSCONFIG, ">".$filename) |
5296 |
or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)"; |
5306 |
or die "Sorry, can't create $filename ($!)."; |
5297 |
print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n"; |
5307 |
print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n"; |
5298 |
print SYSCONFIG <<'EOT'; |
5308 |
print SYSCONFIG <<'EOT'; |
5299 |
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to |
5309 |
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to |
Lines 5304-5309
Link Here
|
5304 |
# BUS_MODULES for any required bus driver module (for example for I2C or SPI). |
5314 |
# BUS_MODULES for any required bus driver module (for example for I2C or SPI). |
5305 |
|
5315 |
|
5306 |
EOT |
5316 |
EOT |
|
|
5317 |
print SYSCONFIG |
5318 |
"# Load modules at startup\n". |
5319 |
"LOADMODULES=yes\n\n". |
5320 |
"# Initialize sensors at startup\n". |
5321 |
"INITSENSORS=yes\n\n"; |
5307 |
print SYSCONFIG "BUS_MODULES=\"", join(" ", @{$bus_modules}), "\"\n" |
5322 |
print SYSCONFIG "BUS_MODULES=\"", join(" ", @{$bus_modules}), "\"\n" |
5308 |
if @{$bus_modules}; |
5323 |
if @{$bus_modules}; |
5309 |
print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n"; |
5324 |
print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n"; |
Lines 5312-5317
Link Here
|
5312 |
|
5327 |
|
5313 |
# For compatibility reasons, modules are also listed individually as variables |
5328 |
# For compatibility reasons, modules are also listed individually as variables |
5314 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
5329 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
|
|
5330 |
# Please note that the numbers in MODULE_X must start at 0 and increase in |
5331 |
# steps of 1. Any number that is missing will make the init script skip the |
5332 |
# rest of the modules. Use MODULE_X_ARGS for arguments. |
5333 |
# |
5315 |
# You should use BUS_MODULES and HWMON_MODULES instead if possible. |
5334 |
# You should use BUS_MODULES and HWMON_MODULES instead if possible. |
5316 |
|
5335 |
|
5317 |
EOT |
5336 |
EOT |
Lines 5321-5330
Link Here
|
5321 |
$i++; |
5340 |
$i++; |
5322 |
} |
5341 |
} |
5323 |
close(SYSCONFIG); |
5342 |
close(SYSCONFIG); |
5324 |
|
5343 |
print "Done.\n"; |
5325 |
print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n". |
|
|
5326 |
"for initialization at boot time.\n" |
5327 |
unless -f "/etc/init.d/lm_sensors"; |
5328 |
|
5344 |
|
5329 |
if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") { |
5345 |
if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") { |
5330 |
system("/sbin/insserv", "/etc/init.d/lm_sensors"); |
5346 |
system("/sbin/insserv", "/etc/init.d/lm_sensors"); |
Lines 5338-5357
Link Here
|
5338 |
"kernel modules.\n\n"; |
5354 |
"kernel modules.\n\n"; |
5339 |
} |
5355 |
} |
5340 |
} else { |
5356 |
} else { |
5341 |
print "To load everything that is needed, add this to one of the system\n". |
|
|
5342 |
"initialization scripts (e.g. /etc/rc.d/rc.local):\n\n"; |
5343 |
print "#----cut here----\n"; |
5344 |
if (@{$bus_modules}) { |
5345 |
print "# Adapter drivers\n"; |
5346 |
print "modprobe $_\n" foreach (@{$bus_modules}); |
5347 |
} |
5348 |
print "# Chip drivers\n"; |
5349 |
print "modprobe $_\n" foreach (@{$hwmon_modules}); |
5350 |
print((-e '/usr/bin/sensors' ? |
5351 |
"/usr/bin/sensors -s\n" : |
5352 |
"/usr/local/bin/sensors -s\n"). |
5353 |
"#----cut here----\n\n"); |
5354 |
|
5355 |
print "If you have some drivers built into your kernel, the list above will\n". |
5357 |
print "If you have some drivers built into your kernel, the list above will\n". |
5356 |
"contain too many modules. Skip the appropriate ones! You really\n". |
5358 |
"contain too many modules. Skip the appropriate ones! You really\n". |
5357 |
"should try these commands right now to make sure everything is\n". |
5359 |
"should try these commands right now to make sure everything is\n". |