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

Collapse All | Expand All

(-)lm_sensors-3.0.3.orig/prog/detect/sensors-detect (-29 / +36 lines)
Lines 27-32 Link Here
27
# each be put in a separate file, using modules and packages. That is beyond
27
# each be put in a separate file, using modules and packages. That is beyond
28
# me.
28
# me.
29
29
30
# Gentoo specific modifications based on a patch from Rudo Thomas
31
# <thomr9am@ss1000.ms.mff.cuni.cz>
32
30
require 5.004;
33
require 5.004;
31
34
32
use strict;
35
use strict;
Lines 6076-6104 Link Here
6076
      print MODPROBE_D $configfile;
6079
      print MODPROBE_D $configfile;
6077
      close(MODPROBE_D);
6080
      close(MODPROBE_D);
6078
    } else {
6081
    } else {
6082
      print "\nIf you want to load the modules at startup, generate a config file\n",
6083
            "below and make sure lm_sensors gets started at boot time; e.g\n",
6084
            "\$ rc-update add lm_sensors default\n";
6079
      print "To make the sensors modules behave correctly, add these lines to\n".
6085
      print "To make the sensors modules behave correctly, add these lines to\n".
6080
            "$modules_conf:\n\n";
6086
            "/etc/modules.d/lm_sensors and run modules-update:\n\n";
6081
      print "#----cut here----\n".
6087
      print "#----cut here----\n".
6082
            $configfile.
6088
            $configfile.
6083
            "#----cut here----\n\n";
6089
            "#----cut here----\n\n";
6084
    }
6090
    }
6085
  }
6091
  }
6086
6092
6087
  my $have_sysconfig = -d '/etc/sysconfig';
6093
  my $have_config = -f '/etc/conf.d/lm_sensors';
6088
  printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
6094
  print "\nDo you want to ".($have_config?"overwrite":"generate").
6089
         (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
6095
        " /etc/conf.d/lm_sensors? Enter s to specify other file name?\n",
6090
         ($have_sysconfig ? 'YES/no' : 'yes/NO');
6096
        "  (".($have_config?"yes/NO":"YES/no")."/s): ";
6091
  $_ = <STDIN>;
6097
  my $reply = <STDIN>;
6092
  if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {
6098
6093
    unless ($have_sysconfig) {
6099
  if (($have_config and $reply =~ /^\s*[Yy]/) or
6094
      mkdir('/etc/sysconfig', 0777)
6100
	 (not $have_config and not $reply =~ /^\s*[Nn]/) or
6095
        or die "Sorry, can't create /etc/sysconfig ($!)";
6101
	 $reply =~ /^\s*[Ss]/) {
6096
    }
6102
	 my $filename = "/etc/conf.d/lm_sensors";
6097
    open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
6103
	 if ($reply =~ /^\s*[Ss]/) {
6098
      or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
6104
		 print "Specify the file to store the configuration to: ";
6099
    print SYSCONFIG <<'EOT';
6105
		 $filename = <STDIN>;
6100
#    /etc/sysconfig/lm_sensors - Defines modules loaded by
6106
	 }
6101
#                                /etc/init.d/lm_sensors
6107
	 open(SYSCONFIG, ">".$filename)
6108
		 or die "Sorry, can't create $filename ($!).";
6109
	 print SYSCONFIG <<'EOT';
6110
#    /etc/conf.d/sensors - Defines modules loaded by /etc/init.d/lm_sensors
6102
#    Copyright (c) 1998 - 2001  Frodo Looijaard <frodol@dds.nl>
6111
#    Copyright (c) 1998 - 2001  Frodo Looijaard <frodol@dds.nl>
6103
#
6112
#
6104
#    This program is free software; you can redistribute it and/or modify
6113
#    This program is free software; you can redistribute it and/or modify
Lines 6127-6138 Link Here
6127
# in order as normal variables with the special names:
6136
# in order as normal variables with the special names:
6128
#    MODULE_0, MODULE_1, MODULE_2, etc.
6137
#    MODULE_0, MODULE_1, MODULE_2, etc.
6129
#
6138
#
6139
# Please note that the numbers in MODULE_X must start at 0 and increase in
6140
# steps of 1. Any number that is missing will make the init script skip the
6141
# rest of the modules. Use MODULE_X_ARGS for arguments.
6142
#
6130
# List the modules that are to be loaded for your system
6143
# List the modules that are to be loaded for your system
6131
#
6144
#
6132
EOT
6145
EOT
6133
    print SYSCONFIG
6146
    print SYSCONFIG
6134
      "# Generated by sensors-detect on " . scalar localtime() . "\n";
6147
      "# Generated by sensors-detect on " . scalar localtime() . "\n\n";
6135
    my @modules = grep /^modprobe /, split "\n", $modprobes;
6148
    my @modules = grep /^modprobe /, split "\n", $modprobes;
6149
    print SYSCONFIG
6150
		 "# Load modules at startup\n".
6151
		 "LOADMODULES=yes\n\n".
6152
		 "# Initialize sensors at startup\n".
6153
		 "INITSENSORS=yes\n\n";
6136
    my $i = 0;
6154
    my $i = 0;
6137
    my $sysconfig = "";
6155
    my $sysconfig = "";
6138
    foreach (@modules) {
6156
    foreach (@modules) {
Lines 6142-6151 Link Here
6142
    }
6160
    }
6143
    print SYSCONFIG $sysconfig;
6161
    print SYSCONFIG $sysconfig;
6144
    close(SYSCONFIG);
6162
    close(SYSCONFIG);
6163
    print "Done.\n";
6145
6164
6146
    print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
6147
          "for initialization at boot time.\n"
6148
      unless -f "/etc/init.d/lm_sensors";
6149
6165
6150
    if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
6166
    if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
6151
      system("/sbin/insserv", "/etc/init.d/lm_sensors");
6167
      system("/sbin/insserv", "/etc/init.d/lm_sensors");
Lines 6159-6173 Link Here
6159
            "kernel modules.\n\n";
6175
            "kernel modules.\n\n";
6160
    }
6176
    }
6161
  } else {
6177
  } else {
6162
    print "To load everything that is needed, add this to one of the system\n".
6163
          "initialization scripts (e.g. /etc/rc.d/rc.local):\n\n";
6164
    print "#----cut here----\n".
6165
          $modprobes.
6166
          (-e '/usr/bin/sensors' ?
6167
            "/usr/bin/sensors -s\n" :
6168
            "/usr/local/bin/sensors -s\n") .
6169
          "#----cut here----\n\n";
6170
6171
    print "If you have some drivers built into your kernel, the list above will\n".
6178
    print "If you have some drivers built into your kernel, the list above will\n".
6172
          "contain too many modules. Skip the appropriate ones! You really\n".
6179
          "contain too many modules. Skip the appropriate ones! You really\n".
6173
          "should try these commands right now to make sure everything is\n".
6180
          "should try these commands right now to make sure everything is\n".

Return to bug 244598