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-3.0.1.orig/prog/detect/sensors-detect (-21 / +44 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 5871-5899 Link Here
5871
      print MODPROBE_D $configfile;
5874
      print MODPROBE_D $configfile;
5872
      close(MODPROBE_D);
5875
      close(MODPROBE_D);
5873
    } else {
5876
    } else {
5877
      print "\nIf you want to load the modules at startup, generate a config file\n",
5878
            "below and make sure lm_sensors gets started at boot time; e.g\n",
5879
            "\$ rc-update add lm_sensors default\n";
5874
      print "To make the sensors modules behave correctly, add these lines to\n".
5880
      print "To make the sensors modules behave correctly, add these lines to\n".
5875
            "$modules_conf:\n\n";
5881
            "/etc/modules.d/lm_sensors and run modules-update:\n\n";
5876
      print "#----cut here----\n".
5882
      print "#----cut here----\n".
5877
            $configfile.
5883
            $configfile.
5878
            "#----cut here----\n\n";
5884
            "#----cut here----\n\n";
5879
    }
5885
    }
5880
  }
5886
  }
5881
5887
5882
  my $have_sysconfig = -d '/etc/sysconfig';
5888
  print "To load everything that is needed, execute the commands below...";
5883
  printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
5889
5884
         (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
5890
  print "\n\n#----cut here----\n";
5885
         ($have_sysconfig ? 'YES/no' : 'yes/NO');
5891
  print $modprobes;
5886
  $_ = <STDIN>;
5892
  print "# sleep 2 # optional\n",
5887
  if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {
5893
        "/usr/bin/sensors -s # recommended\n";
5888
    unless ($have_sysconfig) {
5894
  print "#----end cut here----\n";
5889
      mkdir '/etc/sysconfig', 0777
5895
5890
        or die "Sorry, can't create /etc/sysconfig ($!)";
5896
  my $have_config = -f '/etc/conf.d/lm_sensors';
5891
    }
5897
  print "\nDo you want to ".($have_config?"overwrite":"generate").
5892
    open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
5898
           " /etc/conf.d/lm_sensors? Enter s to specify other file name?\n",
5893
      or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
5899
        "  (".($have_config?"yes/NO":"YES/no")."/s): ";
5894
    print SYSCONFIG <<'EOT';
5900
  my $reply = <STDIN>;
5895
#    /etc/sysconfig/lm_sensors - Defines modules loaded by
5901
5896
#                                /etc/init.d/lm_sensors
5902
  if (($have_config and $reply =~ /^\s*[Yy]/) or
5903
         (not $have_config and not $reply =~ /^\s*[Nn]/) or
5904
         $reply =~ /^\s*[Ss]/) {
5905
         my $filename = "/etc/conf.d/lm_sensors";
5906
         if ($reply =~ /^\s*[Ss]/) {
5907
                 print "Specify the file to store the configuration to: ";
5908
                 $filename = <STDIN>;
5909
         }
5910
         open(SYSCONFIG, ">".$filename)
5911
                 or die "Sorry, can't create $filename ($!).";
5912
         print SYSCONFIG <<'EOT';
5913
#    /etc/conf.d/sensors - Defines modules loaded by /etc/init.d/lm_sensors
5897
#    Copyright (c) 1998 - 2001  Frodo Looijaard <frodol@dds.nl>
5914
#    Copyright (c) 1998 - 2001  Frodo Looijaard <frodol@dds.nl>
5898
#
5915
#
5899
#    This program is free software; you can redistribute it and/or modify
5916
#    This program is free software; you can redistribute it and/or modify
Lines 5921-5932 Link Here
5921
# in order as normal variables with the special names:
5938
# in order as normal variables with the special names:
5922
#    MODULE_0, MODULE_1, MODULE_2, etc.
5939
#    MODULE_0, MODULE_1, MODULE_2, etc.
5923
#
5940
#
5941
# Please note that the numbers in MODULE_X must start at 0 and increase in
5942
# steps of 1. Any number that is missing will make the init script skip the
5943
# rest of the modules. Use MODULE_X_ARGS for arguments.
5944
#
5924
# List the modules that are to be loaded for your system
5945
# List the modules that are to be loaded for your system
5925
#
5946
#
5926
EOT
5947
EOT
5927
    print SYSCONFIG
5948
    print SYSCONFIG
5928
      "# Generated by sensors-detect on " . scalar localtime() . "\n";
5949
      "# Generated by sensors-detect on " . scalar localtime() . "\n\n";
5929
    my @modules = grep /^modprobe /, split "\n", $modprobes;
5950
    my @modules = grep /^modprobe /, split "\n", $modprobes;
5951
    print SYSCONFIG
5952
                 "# Load modules at startup\n".
5953
                 "LOADMODULES=yes\n\n".
5954
                 "# Initialize sensors at startup\n".
5955
                 "INITSENSORS=yes\n\n";
5930
    my $i = 0;
5956
    my $i = 0;
5931
    my $sysconfig = "";
5957
    my $sysconfig = "";
5932
    foreach (@modules) {
5958
    foreach (@modules) {
Lines 5936-5945 Link Here
5936
    }
5962
    }
5937
    print SYSCONFIG $sysconfig;
5963
    print SYSCONFIG $sysconfig;
5938
    close(SYSCONFIG);
5964
    close(SYSCONFIG);
5939
5965
    print "Done.\n";
5940
    print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
5941
          "for initialization at boot time.\n"
5942
      unless -f "/etc/init.d/lm_sensors";
5943
5966
5944
    if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
5967
    if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
5945
      system("/sbin/insserv", "/etc/init.d/lm_sensors");
5968
      system("/sbin/insserv", "/etc/init.d/lm_sensors");

Return to bug 198030