1 |
dberkholz 08/03/17 07:59:28 |
2 |
|
3 |
Added: lm_sensors-3.0.1-sensors-detect-gentoo.patch |
4 |
lm_sensors-3-init.d |
5 |
Log: |
6 |
Add the next-generation version of lm_sensors. This is now chip-independent and is userspace-only, no kernel modules. The lm_sensors 2.x code was split into this and a separate package called i2c-tools. Non-i2c hardware monitoring stays here, and i2c monitoring is provided by that package. Bump OK'd by genstef. |
7 |
(Portage version: 2.1.4.4) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-apps/lm_sensors/files/lm_sensors-3.0.1-sensors-detect-gentoo.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/lm_sensors/files/lm_sensors-3.0.1-sensors-detect-gentoo.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/lm_sensors/files/lm_sensors-3.0.1-sensors-detect-gentoo.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: lm_sensors-3.0.1-sensors-detect-gentoo.patch |
16 |
=================================================================== |
17 |
diff -urN lm_sensors-3.0.1.orig/prog/detect/sensors-detect lm_sensors-3.0.1/prog/detect/sensors-detect |
18 |
--- lm_sensors-3.0.1.orig/prog/detect/sensors-detect 2008-01-22 04:22:47.000000000 -0800 |
19 |
+++ lm_sensors-3.0.1/prog/detect/sensors-detect 2008-03-16 15:52:15.000000000 -0700 |
20 |
@@ -26,6 +26,9 @@ |
21 |
# each be put in a separate file, using modules and packages. That is beyond |
22 |
# me. |
23 |
|
24 |
+# Gentoo specific modifications based on a patch from Rudo Thomas |
25 |
+# <thomr9am@××××××××××××××××××.cz> |
26 |
+ |
27 |
require 5.004; |
28 |
|
29 |
use strict; |
30 |
@@ -5871,29 +5874,35 @@ |
31 |
print MODPROBE_D $configfile; |
32 |
close(MODPROBE_D); |
33 |
} else { |
34 |
+ print "\nIf you want to load the modules at startup, generate a config file\n", |
35 |
+ "below and make sure lm_sensors gets started at boot time; e.g\n", |
36 |
+ "\$ rc-update add lm_sensors default\n"; |
37 |
print "To make the sensors modules behave correctly, add these lines to\n". |
38 |
- "$modules_conf:\n\n"; |
39 |
+ "/etc/modules.d/lm_sensors and run modules-update:\n\n"; |
40 |
print "#----cut here----\n". |
41 |
$configfile. |
42 |
"#----cut here----\n\n"; |
43 |
} |
44 |
} |
45 |
|
46 |
- my $have_sysconfig = -d '/etc/sysconfig'; |
47 |
- printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ", |
48 |
- (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'), |
49 |
- ($have_sysconfig ? 'YES/no' : 'yes/NO'); |
50 |
- $_ = <STDIN>; |
51 |
- if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) { |
52 |
- unless ($have_sysconfig) { |
53 |
- mkdir '/etc/sysconfig', 0777 |
54 |
- or die "Sorry, can't create /etc/sysconfig ($!)"; |
55 |
- } |
56 |
- open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors") |
57 |
- or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)"; |
58 |
- print SYSCONFIG <<'EOT'; |
59 |
-# /etc/sysconfig/lm_sensors - Defines modules loaded by |
60 |
-# /etc/init.d/lm_sensors |
61 |
+ my $have_config = -f '/etc/conf.d/lm_sensors'; |
62 |
+ print "\nDo you want to ".($have_config?"overwrite":"generate"). |
63 |
+ " /etc/conf.d/lm_sensors? Enter s to specify other file name?\n", |
64 |
+ " (".($have_config?"yes/NO":"YES/no")."/s): "; |
65 |
+ my $reply = <STDIN>; |
66 |
+ |
67 |
+ if (($have_config and $reply =~ /^\s*[Yy]/) or |
68 |
+ (not $have_config and not $reply =~ /^\s*[Nn]/) or |
69 |
+ $reply =~ /^\s*[Ss]/) { |
70 |
+ my $filename = "/etc/conf.d/lm_sensors"; |
71 |
+ if ($reply =~ /^\s*[Ss]/) { |
72 |
+ print "Specify the file to store the configuration to: "; |
73 |
+ $filename = <STDIN>; |
74 |
+ } |
75 |
+ open(SYSCONFIG, ">".$filename) |
76 |
+ or die "Sorry, can't create $filename ($!)."; |
77 |
+ print SYSCONFIG <<'EOT'; |
78 |
+# /etc/conf.d/sensors - Defines modules loaded by /etc/init.d/lm_sensors |
79 |
# Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@×××.nl> |
80 |
# |
81 |
# This program is free software; you can redistribute it and/or modify |
82 |
@@ -5921,12 +5930,21 @@ |
83 |
# in order as normal variables with the special names: |
84 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
85 |
# |
86 |
+# Please note that the numbers in MODULE_X must start at 0 and increase in |
87 |
+# steps of 1. Any number that is missing will make the init script skip the |
88 |
+# rest of the modules. Use MODULE_X_ARGS for arguments. |
89 |
+# |
90 |
# List the modules that are to be loaded for your system |
91 |
# |
92 |
EOT |
93 |
print SYSCONFIG |
94 |
- "# Generated by sensors-detect on " . scalar localtime() . "\n"; |
95 |
+ "# Generated by sensors-detect on " . scalar localtime() . "\n\n"; |
96 |
my @modules = grep /^modprobe /, split "\n", $modprobes; |
97 |
+ print SYSCONFIG |
98 |
+ "# Load modules at startup\n". |
99 |
+ "LOADMODULES=yes\n\n". |
100 |
+ "# Initialize sensors at startup\n". |
101 |
+ "INITSENSORS=yes\n\n"; |
102 |
my $i = 0; |
103 |
my $sysconfig = ""; |
104 |
foreach (@modules) { |
105 |
@@ -5936,10 +5954,8 @@ |
106 |
} |
107 |
print SYSCONFIG $sysconfig; |
108 |
close(SYSCONFIG); |
109 |
+ print "Done.\n"; |
110 |
|
111 |
- print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n". |
112 |
- "for initialization at boot time.\n" |
113 |
- unless -f "/etc/init.d/lm_sensors"; |
114 |
|
115 |
if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") { |
116 |
system("/sbin/insserv", "/etc/init.d/lm_sensors"); |
117 |
@@ -5948,15 +5964,6 @@ |
118 |
"kernel modules.\n\n"; |
119 |
} |
120 |
} else { |
121 |
- print "To load everything that is needed, add this to one of the system\n". |
122 |
- "initialization scripts (e.g. /etc/rc.d/rc.local):\n\n"; |
123 |
- print "#----cut here----\n". |
124 |
- $modprobes. |
125 |
- (-e '/usr/bin/sensors' ? |
126 |
- "/usr/bin/sensors -s\n" : |
127 |
- "/usr/local/bin/sensors -s\n") . |
128 |
- "#----cut here----\n\n"; |
129 |
- |
130 |
print "If you have some drivers built into your kernel, the list above will\n". |
131 |
"contain too many modules. Skip the appropriate ones! You really\n". |
132 |
"should try these commands right now to make sure everything is\n". |
133 |
|
134 |
|
135 |
|
136 |
1.1 sys-apps/lm_sensors/files/lm_sensors-3-init.d |
137 |
|
138 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/lm_sensors/files/lm_sensors-3-init.d?rev=1.1&view=markup |
139 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/lm_sensors/files/lm_sensors-3-init.d?rev=1.1&content-type=text/plain |
140 |
|
141 |
Index: lm_sensors-3-init.d |
142 |
=================================================================== |
143 |
#!/sbin/runscript |
144 |
# Copyright 1999-2006 Gentoo Foundation |
145 |
# Distributed under the terms of the GNU General Public License v2 |
146 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/lm_sensors/files/lm_sensors-3-init.d,v 1.1 2008/03/17 07:59:28 dberkholz Exp $ |
147 |
|
148 |
checkconfig() { |
149 |
if [ ! -f /etc/conf.d/lm_sensors ]; then |
150 |
eerror "/etc/conf.d/lm_sensors does not exist, try running sensors-detect" |
151 |
return 1 |
152 |
fi |
153 |
|
154 |
if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then |
155 |
if [ -z "${MODULE_0}" ]; then |
156 |
eerror "MODULE_0 is not set in /etc/conf.d/lm_sensors, try running sensors-detect" |
157 |
return 1 |
158 |
fi |
159 |
fi |
160 |
} |
161 |
|
162 |
start() { |
163 |
checkconfig || return 1 |
164 |
|
165 |
if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then |
166 |
einfo "Loading lm_sensors modules..." |
167 |
|
168 |
mount | grep sysfs >/dev/null 2>&1 |
169 |
if [ ${?} = 0 ]; then |
170 |
if ! ( [ -e /sys/i2c ] || [ -e /sys/bus/i2c ] ); then |
171 |
ebegin " Loading i2c-core" |
172 |
modprobe i2c-core >/dev/null 2>&1 |
173 |
if [ ${?} != 0 ]; then |
174 |
eerror " Could not load i2c-core!" |
175 |
eend 1 |
176 |
fi |
177 |
( [ -e /sys/i2c ] || [ -e /sys/bus/i2c ] ) || return 1 |
178 |
eend 0 |
179 |
fi |
180 |
elif ! [ -e /proc/sys/dev/sensors ]; then |
181 |
ebegin " Loading i2c-proc" |
182 |
modprobe i2c-proc >/dev/null 2>&1 |
183 |
if [ ${?} != 0 ]; then |
184 |
eerror " Could not load i2c-proc!" |
185 |
eend 1 |
186 |
fi |
187 |
[ -e /proc/sys/dev/sensors ] || return 1 |
188 |
eend 0 |
189 |
fi |
190 |
|
191 |
i=0 |
192 |
while true; do |
193 |
module=`eval echo '$'MODULE_${i}` |
194 |
module_args=`eval echo '$'MODULE_${i}_ARGS` |
195 |
if [ -z "${module}" ]; then |
196 |
break |
197 |
fi |
198 |
ebegin " Loading ${module}" |
199 |
modprobe ${module} ${module_args} >/dev/null 2>&1 |
200 |
eend $? |
201 |
i=$(($i+1)) |
202 |
done |
203 |
fi |
204 |
|
205 |
if [ "${INITSENSORS}" = "yes" ]; then |
206 |
if ! [ -f /etc/sensors3.conf ]; then |
207 |
eerror "/etc/sensors3.conf does not exist!" |
208 |
return 1 |
209 |
fi |
210 |
|
211 |
ebegin "Initializing sensors" |
212 |
/usr/bin/sensors -s >/dev/null 2>&1 |
213 |
eend ${?} |
214 |
fi |
215 |
} |
216 |
|
217 |
stop() { |
218 |
checkconfig || return 1 |
219 |
|
220 |
if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then |
221 |
einfo "Unloading lm_sensors modules..." |
222 |
|
223 |
# find the highest possible MODULE_ number |
224 |
i=0 |
225 |
while true; do |
226 |
module=`eval echo '$'MODULE_${i}` |
227 |
if [ -z "${module}" ] ; then |
228 |
break |
229 |
fi |
230 |
i=$(($i+1)) |
231 |
done |
232 |
|
233 |
while [ ${i} -gt 0 ]; do |
234 |
i=$(($i-1)) |
235 |
module=`eval echo '$'MODULE_${i}` |
236 |
ebegin " Unloading ${module}" |
237 |
rmmod ${module} >/dev/null 2>&1 |
238 |
eend $? |
239 |
done |
240 |
|
241 |
if [ -e /proc/sys/dev/sensors ] ; then |
242 |
ebegin " Unloading i2c-proc" |
243 |
rmmod i2c-proc >/dev/null 2>&1 |
244 |
eend $? |
245 |
fi |
246 |
fi |
247 |
} |
248 |
|
249 |
|
250 |
|
251 |
-- |
252 |
gentoo-commits@l.g.o mailing list |