Gentoo Archives: gentoo-commits

From: "Lars Wendler (polynomial-c)" <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/lm_sensors/files: lm_sensors-3.3.1-sensors-detect-gentoo.patch
Date: Fri, 30 Sep 2011 19:58:21
Message-Id: 20110930195810.AFE8C20036@flycatcher.gentoo.org
1 polynomial-c 11/09/30 19:58:10
2
3 Added: lm_sensors-3.3.1-sensors-detect-gentoo.patch
4 Log:
5 Version bump (bug #377223)
6
7 (Portage version: 2.2.0_alpha60/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 sys-apps/lm_sensors/files/lm_sensors-3.3.1-sensors-detect-gentoo.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/lm_sensors/files/lm_sensors-3.3.1-sensors-detect-gentoo.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/lm_sensors/files/lm_sensors-3.3.1-sensors-detect-gentoo.patch?rev=1.1&content-type=text/plain
14
15 Index: lm_sensors-3.3.1-sensors-detect-gentoo.patch
16 ===================================================================
17 --- lm_sensors-3.3.1/prog/detect/sensors-detect
18 +++ lm_sensors-3.3.1/prog/detect/sensors-detect
19 @@ -20,6 +20,9 @@
20 # MA 02110-1301 USA.
21 #
22
23 +# Gentoo specific modifications based on a patch from Rudo Thomas
24 +# <thomr9am@××××××××××××××××××.cz>
25 +
26 require 5.004;
27
28 use strict;
29 @@ -6471,26 +6474,33 @@
30 print MODPROBE_D $configfile;
31 close(MODPROBE_D);
32 } else {
33 + print "\nIf you want to load the modules at startup, generate a config file\n",
34 + "below and make sure lm_sensors gets started at boot time; e.g\n",
35 + "\$ rc-update add lm_sensors default\n";
36 print "To make the sensors modules behave correctly, add these lines to\n".
37 - "/etc/modprobe.conf:\n\n";
38 + "/etc/modules.d/lm_sensors and run modules-update:\n\n";
39 print "#----cut here----\n".
40 $configfile.
41 "#----cut here----\n\n";
42 }
43 }
44
45 - my $have_sysconfig = -d '/etc/sysconfig';
46 - printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
47 - (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
48 - ($have_sysconfig ? 'YES/no' : 'yes/NO');
49 - $_ = <STDIN>;
50 - if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {
51 - unless ($have_sysconfig) {
52 - mkdir('/etc/sysconfig', 0777)
53 - or die "Sorry, can't create /etc/sysconfig ($!)";
54 + my $have_config = -f '/etc/conf.d/lm_sensors';
55 + print "\nDo you want to ".($have_config?"overwrite":"generate").
56 + " /etc/conf.d/lm_sensors? Enter s to specify other file name?\n",
57 + " (".($have_config?"yes/NO":"YES/no")."/s): ";
58 + my $reply = <STDIN>;
59 +
60 + if (($have_config and $reply =~ /^\s*[Yy]/) or
61 + (not $have_config and not $reply =~ /^\s*[Nn]/) or
62 + $reply =~ /^\s*[Ss]/) {
63 + my $filename = "/etc/conf.d/lm_sensors";
64 + if ($reply =~ /^\s*[Ss]/) {
65 + print "Specify the file to store the configuration to: ";
66 + $filename = <STDIN>;
67 }
68 - open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
69 - or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
70 + open(local *SYSCONFIG, ">".$filename)
71 + or die "Sorry, can't create $filename ($!).";
72 print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n";
73 print SYSCONFIG <<'EOT';
74 # This file is sourced by /etc/init.d/lm_sensors and defines the modules to
75 @@ -6501,6 +6511,11 @@
76 # BUS_MODULES for any required bus driver module (for example for I2C or SPI).
77
78 EOT
79 + print SYSCONFIG
80 + "# Load modules at startup\n".
81 + "LOADMODULES=yes\n\n".
82 + "# Initialize sensors at startup\n".
83 + "INITSENSORS=yes\n\n";
84 print SYSCONFIG "BUS_MODULES=\"", join(" ", @{$bus_modules}), "\"\n"
85 if @{$bus_modules};
86 print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n";
87 @@ -6509,6 +6524,10 @@
88
89 # For compatibility reasons, modules are also listed individually as variables
90 # MODULE_0, MODULE_1, MODULE_2, etc.
91 +# Please note that the numbers in MODULE_X must start at 0 and increase in
92 +# steps of 1. Any number that is missing will make the init script skip the
93 +# rest of the modules. Use MODULE_X_ARGS for arguments.
94 +#
95 # You should use BUS_MODULES and HWMON_MODULES instead if possible.
96
97 EOT
98 @@ -6519,25 +6538,7 @@
99 }
100 close(SYSCONFIG);
101
102 - if (-x "/bin/systemctl" && -d "/lib/systemd/system" &&
103 - ! -f "/lib/systemd/system/lm_sensors.service") {
104 - print "Copy prog/init/lm_sensors.service to /lib/systemd/system\n".
105 - "and run 'systemctl enable lm_sensors.service'\n".
106 - "for initialization at boot time.\n";
107 - return;
108 - }
109 -
110 - if (-x "/bin/systemctl" &&
111 - -f "/lib/systemd/system/lm_sensors.service") {
112 - system("/bin/systemctl", "enable", "lm_sensors.service");
113 - system("/bin/systemctl", "start", "lm_sensors.service");
114 - # All done, don't check for /etc/init.d/lm_sensors
115 - return;
116 - }
117 -
118 - print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
119 - "for initialization at boot time.\n"
120 - unless -f "/etc/init.d/lm_sensors";
121 + print "Done.\n";
122
123 if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
124 system("/sbin/insserv", "/etc/init.d/lm_sensors");
125 @@ -6551,20 +6552,6 @@
126 "kernel modules.\n\n";
127 }
128 } else {
129 - print "To load everything that is needed, add this to one of the system\n".
130 - "initialization scripts (e.g. /etc/rc.d/rc.local):\n\n";
131 - print "#----cut here----\n";
132 - if (@{$bus_modules}) {
133 - print "# Adapter drivers\n";
134 - print "modprobe $_\n" foreach (@{$bus_modules});
135 - }
136 - print "# Chip drivers\n";
137 - print "modprobe $_\n" foreach (@{$hwmon_modules});
138 - print((-e '/usr/bin/sensors' ?
139 - "/usr/bin/sensors -s\n" :
140 - "/usr/local/bin/sensors -s\n").
141 - "#----cut here----\n\n");
142 -
143 print "If you have some drivers built into your kernel, the list above will\n".
144 "contain too many modules. Skip the appropriate ones! You really\n".
145 "should try these commands right now to make sure everything is\n".