Changeset 5081

Show
Ignore:
Timestamp:
12/18/07 14:08:34 (1 year ago)
Author:
khali
Message:

Improve sysconfig and modprobe.d integration, based on suggestions by
Gary Funck:
* If we create /etc/sysconfig/lm_sensors, there's no point in printing

the modprobe commands on the screen.

* Otherwise, suggest /etc/rc.d/rc.local as the init script where to put

the commands.

* If /etc/modprobe.d exists, create a file there to store the module

options, rather than printing them on the screen.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/CHANGES

    r5074 r5081  
    2929                          Reduce w83781d/lm78 I2C address probing range 
    3030                          Drop PCA9540 detection 
    31                           Add Intel Celeron 4xx and Penryn (CPU on 45nm) detection 
     31                          Add Intel Celeron 4xx and Penryn (CPU on 45nm) 
     32                           detection 
     33                          Improve sysconfig and modprobe.d integration 
    3234 
    33352.10.5 (20071024) 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r5065 r5081  
    58355835  print "\n"; 
    58365836 
    5837   print "I will now generate the commands needed to load the required modules.\n". 
    5838         "Just press ENTER to continue: "; 
    5839   <STDIN>; 
    5840       
    5841   print "\n"; 
    58425837  my ($modprobes, $configfile) = generate_modprobes 1;  # 1 == prefer ISA 
     5838 
    58435839  if (defined $configfile) { 
    5844     print "To make the sensors modules behave correctly, add these lines to\n". 
    5845           "$modules_conf:\n\n"; 
    5846     print "#----cut here----\n". 
    5847           $configfile. 
    5848           "#----cut here----\n\n"; 
    5849   } 
    5850  
    5851   print "To load everything that is needed, add this to some /etc/rc* file:\n\n"; 
    5852   print "#----cut here----\n". 
    5853         $modprobes. 
    5854         "# sleep 2 # optional\n". 
    5855         (-e '/usr/bin/sensors' ? 
    5856           "/usr/bin/sensors -s # recommended\n" : 
    5857           "/usr/local/bin/sensors -s # recommended\n") . 
    5858         "#----cut here----\n\n"; 
    5859  
    5860   print "If you have some drivers built into your kernel, the list above will\n". 
    5861         "contain too many modules. Skip the appropriate ones! You really\n". 
    5862         "should try these commands right now to make sure everything is\n". 
    5863         "working properly. Monitoring programs won't work until the needed\n". 
    5864         "modules are loaded.\n\n"; 
    5865    
     5840    my $have_modprobe_d = -d '/etc/modprobe.d'; 
     5841    printf "Do you want to \%s /etc/modprobe.d/lm_sensors? (\%s): ", 
     5842           (-e '/etc/modprobe.d/lm_sensors' ? 'overwrite' : 'generate'), 
     5843           ($have_modprobe_d ? 'YES/no' : 'yes/NO'); 
     5844    $_ = <STDIN>; 
     5845    if (($have_modprobe_d and not m/^\s*n/i) or m/^\s*y/i) { 
     5846      unless ($have_modprobe_d) { 
     5847        mkdir '/etc/modprobe.d', 0777 
     5848          or die "Sorry, can't create /etc/modprobe.d ($!)"; 
     5849      } 
     5850      open(local *MODPROBE_D, ">/etc/modprobe.d/lm_sensors") 
     5851        or die "Sorry, can't create /etc/modprobe.d/lm_sensors ($!)"; 
     5852      print MODPROBE_D 
     5853        "# Generated by sensors-detect on " . scalar localtime() . "\n"; 
     5854      print MODPROBE_D $configfile; 
     5855      close(MODPROBE_D); 
     5856    } else { 
     5857      print "To make the sensors modules behave correctly, add these lines to\n". 
     5858            "$modules_conf:\n\n"; 
     5859      print "#----cut here----\n". 
     5860            $configfile. 
     5861            "#----cut here----\n\n"; 
     5862    } 
     5863  } 
     5864 
    58665865  my $have_sysconfig = -d '/etc/sysconfig'; 
    58675866  printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ", 
     
    59205919    } 
    59215920    print SYSCONFIG $sysconfig; 
     5921    close(SYSCONFIG); 
    59225922 
    59235923    print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n". 
    59245924          "for initialization at boot time.\n" 
    59255925      unless -f "/etc/init.d/lm_sensors"; 
     5926 
     5927    print "You should now start the lm_sensors service to load the required\n". 
     5928          "kernel modules.\n\n"; 
     5929  } else { 
     5930    print "To load everything that is needed, add this to e.g. /etc/rc.d/rc.local:\n\n"; 
     5931    print "#----cut here----\n". 
     5932          $modprobes. 
     5933          "# sleep 2 # optional\n". 
     5934          (-e '/usr/bin/sensors' ? 
     5935            "/usr/bin/sensors -s # recommended\n" : 
     5936            "/usr/local/bin/sensors -s # recommended\n") . 
     5937          "#----cut here----\n\n"; 
     5938 
     5939    print "If you have some drivers built into your kernel, the list above will\n". 
     5940          "contain too many modules. Skip the appropriate ones! You really\n". 
     5941          "should try these commands right now to make sure everything is\n". 
     5942          "working properly. Monitoring programs won't work until the needed\n". 
     5943          "modules are loaded.\n\n"; 
    59265944  } 
    59275945}