Changeset 4119
- Timestamp:
- 08/28/06 23:19:59 (7 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 2 modified
-
CHANGES (modified) (1 diff)
-
prog/detect/sensors-detect (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/CHANGES
r4118 r4119 75 75 Add Analog Devices ADM1033, ADM1034, ADT7462, 76 76 ADT7466, ADT7470, ADT7473 and ADT7475 detection 77 Check for root user at startup 77 78 78 79 -
lm-sensors/trunk/prog/detect/sensors-detect
r4117 r4119 5248 5248 my (@adapters,$res,$did_adapter_detection,$adapter); 5249 5249 5250 # We won't go very far if not root 5251 unless ($> == 0) { 5252 print "You need to be root to run this script.\n"; 5253 exit -1; 5254 } 5255 5250 5256 initialize_conf; 5251 5257 initialize_proc_pci; … … 5258 5264 "load to use lm_sensors most effectively. You need to have i2c and\n", 5259 5265 "lm_sensors installed before running this program.\n"; 5260 print "Also, you need to be `root', or at least have access to the $dev_i2c*\n",5261 "files, for most things.\n";5262 5266 print "If you have patched your kernel and have some drivers built in, you can\n", 5263 5267 "safely answer NO if asked to load some modules. In this case, things may\n", … … 5267 5271 5268 5272 print " We can start with probing for (PCI) I2C or SMBus adapters.\n"; 5269 print " You do not need any special privileges for this.\n";5270 5273 print " Do you want to probe now? (YES/no): "; 5271 5274 @adapters = adapter_pci_detection … … 5277 5280 print "As you skipped adapter detection, we will only scan already loaded\n". 5278 5281 "adapter modules.\n"; 5279 } elsif ($> != 0) {5280 print "As you are not root, we can't load adapter modules. We will only scan\n".5281 "already loaded adapters.\n";5282 5282 } else { 5283 5283 print "We will now try to load each adapter module in turn.\n"; … … 5311 5311 print "i2c-dev is already loaded.\n"; 5312 5312 } else { 5313 if ($> != 0) {5314 print " i2c-dev is not loaded. As you are not root, we will just hope ",5315 "you edited\n",5316 " `$modules_conf' for automatic loading of\n",5317 " this module. If not, you won't be able to open any $dev_i2c* file.\n";5313 print "i2c-dev is not loaded. Do you want to load it now? (YES/no): "; 5314 if (<STDIN> =~ /^\s*n/i) { 5315 print "Well, you will know best.\n"; 5316 } elsif (system "modprobe", "i2c-dev") { 5317 print "Loading failed, expect problems later on.\n"; 5318 5318 } else { 5319 print " i2c-dev is not loaded. Do you want to load it now? (YES/no): "; 5320 if (<STDIN> =~ /^\s*[Nn]/) { 5321 print " Well, you will know best. We will just hope you edited ", 5322 "`$modules_conf'\n", 5323 " for automatic loading of this module. If not,\n", 5324 " you won't be able to open any $dev_i2c* file (unless you", 5325 "have it built-in\n", 5326 " into your kernel)\n"; 5327 } elsif (system "modprobe","i2c-dev") { 5328 print " Loading failed, expect problems later on.\n"; 5329 } else { 5330 print " Module loaded successfully.\n"; 5331 } 5319 print "Module loaded successfully.\n"; 5332 5320 } 5333 5321 } … … 5379 5367 "this. This is usually safe though.\n". 5380 5368 "Yes, you do have ISA I/O ports even if you do not have any ISA slots!\n\n"; 5381 if ($> != 0) { 5382 print "As you are not root, we shall skip this step.\n"; 5383 } else { 5384 print "Do you want to scan the ISA I/O ports? (YES/no): "; 5385 unless (<STDIN> =~ /^\s*n/i) { 5386 initialize_ioports(); 5387 scan_isa_bus(); 5388 close_ioports(); 5389 } 5369 print "Do you want to scan the ISA I/O ports? (YES/no): "; 5370 unless (<STDIN> =~ /^\s*n/i) { 5371 initialize_ioports(); 5372 scan_isa_bus(); 5373 close_ioports(); 5390 5374 } 5391 5375 … … 5393 5377 "typically a bit more dangerous, as we have to write to I/O ports to do\n". 5394 5378 "this. This is usually safe though.\n\n"; 5395 if ($> != 0) { 5396 print "As you are not root, we shall skip this step.\n"; 5397 } else { 5398 print "Do you want to scan for Super I/O sensors? (YES/no): "; 5379 print "Do you want to scan for Super I/O sensors? (YES/no): "; 5380 unless (<STDIN> =~ /^\s*n/i) { 5381 initialize_ioports(); 5382 scan_superio(0x2e, 0x2f); 5383 print "\nDo you want to scan for secondary Super I/O sensors? (YES/no): "; 5399 5384 unless (<STDIN> =~ /^\s*n/i) { 5400 initialize_ioports(); 5401 scan_superio(0x2e, 0x2f); 5402 print "\nDo you want to scan for secondary Super I/O sensors? (YES/no): "; 5403 unless (<STDIN> =~ /^\s*n/i) { 5404 scan_superio(0x4e, 0x4f); 5405 } 5406 close_ioports(); 5385 scan_superio(0x4e, 0x4f); 5407 5386 } 5387 close_ioports(); 5408 5388 } 5409 5389 … … 5481 5461 print "\nDo you want to generate /etc/sysconfig/lm_sensors? (". 5482 5462 ($have_sysconfig?"YES/no":"yes/NO")."): "; 5483 if ($> != 0) { 5484 print "\nAs you are not root, we shall skip this step.\n"; 5485 } else { 5486 $_ = <STDIN>; 5487 if (($have_sysconfig and not m/^\s*[Nn]/) or m/^\s*[Yy]/) { 5488 unless ($have_sysconfig) { 5489 mkdir '/etc/sysconfig', 0777 5490 or die "Sorry, can't create /etc/sysconfig ($!)?!?"; 5491 } 5492 open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors") 5493 or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)?!?"; 5494 print SYSCONFIG <<'EOT'; 5463 $_ = <STDIN>; 5464 if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) { 5465 unless ($have_sysconfig) { 5466 mkdir '/etc/sysconfig', 0777 5467 or die "Sorry, can't create /etc/sysconfig ($!)"; 5468 } 5469 open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors") 5470 or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)"; 5471 print SYSCONFIG <<'EOT'; 5495 5472 # /etc/sysconfig/sensors - Defines modules loaded by /etc/rc.d/init.d/lm_sensors 5496 5473 # Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl> … … 5524 5501 # 5525 5502 EOT 5526 print SYSCONFIG 5527 "# Generated by sensors-detect on " . scalar localtime() . "\n"; 5528 my @modules = grep /^modprobe /, split "\n", $modprobes; 5529 my $i = 0; 5530 my $sysconfig = ""; 5531 foreach (@modules) { 5532 s/^modprobe //; 5533 $sysconfig .= "MODULE_$i=$_\n"; 5534 $i++; 5535 } 5536 print SYSCONFIG $sysconfig; 5537 print "Copy prog/init/lm_sensors.init to /etc/rc.d/init.d/lm_sensors\n"; 5538 print "for initialization at boot time.\n"; 5503 print SYSCONFIG 5504 "# Generated by sensors-detect on " . scalar localtime() . "\n"; 5505 my @modules = grep /^modprobe /, split "\n", $modprobes; 5506 my $i = 0; 5507 my $sysconfig = ""; 5508 foreach (@modules) { 5509 s/^modprobe //; 5510 $sysconfig .= "MODULE_$i=$_\n"; 5511 $i++; 5539 5512 } 5513 print SYSCONFIG $sysconfig; 5514 print "Copy prog/init/lm_sensors.init to /etc/rc.d/init.d/lm_sensors\n"; 5515 print "for initialization at boot time.\n"; 5540 5516 } 5541 5517 }
