Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 198030 | Differences between
and this patch

Collapse All | Expand All

(-)lm_sensors-2.10.5.orig/prog/detect/sensors-detect (-21 / +45 lines)
Lines 26-31 Link Here
26
# each be put in a separate file, using modules and packages. That is beyond
26
# each be put in a separate file, using modules and packages. That is beyond
27
# me.
27
# me.
28
28
29
# Gentoo specific modifications based on a patch from Rudo Thomas
30
# <thomr9am@ss1000.ms.mff.cuni.cz>
31
29
require 5.004;
32
require 5.004;
30
33
31
use strict;
34
use strict;
Lines 5845-5852 Link Here
5845
  print "\n";
5848
  print "\n";
5846
  my ($modprobes, $configfile) = generate_modprobes 1;	# 1 == prefer ISA
5849
  my ($modprobes, $configfile) = generate_modprobes 1;	# 1 == prefer ISA
5847
  if (defined $configfile) {
5850
  if (defined $configfile) {
5851
    print "\nIf you want to load the modules at startup, generate a config file\n",
5852
          "below and make sure lm_sensors gets started at boot time; e.g\n",
5853
          "\$ rc-update add lm_sensors default\n";
5848
    print "To make the sensors modules behave correctly, add these lines to\n".
5854
    print "To make the sensors modules behave correctly, add these lines to\n".
5849
          "$modules_conf:\n\n";
5855
          "/etc/modules.d/lm_sensors and run modules-update:\n\n";
5850
    print "#----cut here----\n".
5856
    print "#----cut here----\n".
5851
          $configfile.
5857
          $configfile.
5852
          "#----cut here----\n\n";
5858
          "#----cut here----\n\n";
Lines 5866-5887 Link Here
5866
        "should try these commands right now to make sure everything is\n".
5872
        "should try these commands right now to make sure everything is\n".
5867
        "working properly. Monitoring programs won't work until the needed\n".
5873
        "working properly. Monitoring programs won't work until the needed\n".
5868
        "modules are loaded.\n\n";
5874
        "modules are loaded.\n\n";
5869
  
5875
5870
  my $have_sysconfig = -d '/etc/sysconfig';
5876
  print "To load everything that is needed, execute the commands below...";
5871
  printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
5877
5872
         (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
5878
  print "\n\n#----cut here----\n";
5873
         ($have_sysconfig ? 'YES/no' : 'yes/NO');
5879
  print $modprobes;
5874
  $_ = <STDIN>;
5880
  print "# sleep 2 # optional\n",
5875
  if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {
5881
        "/usr/bin/sensors -s # recommended\n";
5876
    unless ($have_sysconfig) {
5882
  print "#----end cut here----\n";
5877
      mkdir '/etc/sysconfig', 0777
5883
5878
        or die "Sorry, can't create /etc/sysconfig ($!)";
5884
  my $have_config = -f '/etc/conf.d/lm_sensors';
5879
    }
5885
  print "\nDo you want to ".($have_config?"overwrite":"generate").
5880
    open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
5886
           " /etc/conf.d/lm_sensors? Enter s to specify other file name?\n",
5881
      or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
5887
        "  (".($have_config?"yes/NO":"YES/no")."/s): ";
5882
    print SYSCONFIG <<'EOT';
5888
  my $reply = <STDIN>;
5883
#    /etc/sysconfig/lm_sensors - Defines modules loaded by
5889
5884
#                                /etc/init.d/lm_sensors
5890
  if (($have_config and $reply =~ /^\s*[Yy]/) or
5891
         (not $have_config and not $reply =~ /^\s*[Nn]/) or
5892
         $reply =~ /^\s*[Ss]/) {
5893
         my $filename = "/etc/conf.d/lm_sensors";
5894
         if ($reply =~ /^\s*[Ss]/) {
5895
                 print "Specify the file to store the configuration to: ";
5896
                 $filename = <STDIN>;
5897
         }
5898
         open(SYSCONFIG, ">".$filename)
5899
                 or die "Sorry, can't create $filename ($!).";
5900
         print SYSCONFIG <<'EOT';
5901
#    /etc/conf.d/sensors - Defines modules loaded by /etc/init.d/lm_sensors
5885
#    Copyright (c) 1998 - 2001  Frodo Looijaard <frodol@dds.nl>
5902
#    Copyright (c) 1998 - 2001  Frodo Looijaard <frodol@dds.nl>
5886
#
5903
#
5887
#    This program is free software; you can redistribute it and/or modify
5904
#    This program is free software; you can redistribute it and/or modify
Lines 5909-5920 Link Here
5909
# in order as normal variables with the special names:
5926
# in order as normal variables with the special names:
5910
#    MODULE_0, MODULE_1, MODULE_2, etc.
5927
#    MODULE_0, MODULE_1, MODULE_2, etc.
5911
#
5928
#
5929
# Please note that the numbers in MODULE_X must start at 0 and increase in
5930
# steps of 1. Any number that is missing will make the init script skip the
5931
# rest of the modules. Use MODULE_X_ARGS for arguments.
5932
#
5912
# List the modules that are to be loaded for your system
5933
# List the modules that are to be loaded for your system
5913
#
5934
#
5914
EOT
5935
EOT
5915
    print SYSCONFIG
5936
    print SYSCONFIG
5916
      "# Generated by sensors-detect on " . scalar localtime() . "\n";
5937
      "# Generated by sensors-detect on " . scalar localtime() . "\n\n";
5917
    my @modules = grep /^modprobe /, split "\n", $modprobes;
5938
    my @modules = grep /^modprobe /, split "\n", $modprobes;
5939
    print SYSCONFIG
5940
                 "# Load modules at startup\n".
5941
                 "LOADMODULES=yes\n\n".
5942
                 "# Initialize sensors at startup\n".
5943
                 "INITSENSORS=yes\n\n";
5918
    my $i = 0;
5944
    my $i = 0;
5919
    my $sysconfig = "";
5945
    my $sysconfig = "";
5920
    foreach (@modules) {
5946
    foreach (@modules) {
Lines 5923-5932 Link Here
5923
      $i++;
5949
      $i++;
5924
    }
5950
    }
5925
    print SYSCONFIG $sysconfig;
5951
    print SYSCONFIG $sysconfig;
5952
    print "Done.\n";
5926
5953
5927
    print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
5928
          "for initialization at boot time.\n"
5929
      unless -f "/etc/init.d/lm_sensors";
5930
  }
5954
  }
5931
}
5955
}
5932
5956

Return to bug 198030