blob: f4aabda608a9239f8edb4750948f65ec83c97c2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/sbin/openrc-run
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $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 $
checkconfig() {
if [ ! -f /etc/conf.d/lm_sensors ]; then
eerror "/etc/conf.d/lm_sensors does not exist, try running sensors-detect"
return 1
fi
if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then
if [ -z "${HWMON_MODULES}" ]; then
eerror "HWMON_MODULES is not set in /etc/conf.d/lm_sensors, try running sensors-detect"
return 1
fi
fi
}
start() {
checkconfig || return 1
if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then
einfo "Loading lm_sensors modules..."
mount | grep sysfs >/dev/null 2>&1
if [ ${?} = 0 ]; then
if ! ( [ -e /sys/i2c ] || [ -e /sys/bus/i2c ] ); then
ebegin " Loading i2c-core"
modprobe i2c-core >/dev/null 2>&1
if [ ${?} != 0 ]; then
eerror " Could not load i2c-core!"
eend 1
fi
( [ -e /sys/i2c ] || [ -e /sys/bus/i2c ] ) || return 1
eend 0
fi
elif ! [ -e /proc/sys/dev/sensors ]; then
ebegin " Loading i2c-proc"
modprobe i2c-proc >/dev/null 2>&1
if [ ${?} != 0 ]; then
eerror " Could not load i2c-proc!"
eend 1
fi
[ -e /proc/sys/dev/sensors ] || return 1
eend 0
fi
for module in ${BUS_MODULES}; do
ebegin " Loading ${module}"
modprobe ${module} >/dev/null 2>&1
eend $?
done
for module in ${HWMON_MODULES}; do
ebegin " Loading ${module}"
modprobe ${module} >/dev/null 2>&1
eend $?
done
fi
if [ "${INITSENSORS}" = "yes" ]; then
if ! [ -f /etc/sensors3.conf ]; then
eerror "/etc/sensors3.conf does not exist!"
return 1
fi
ebegin "Initializing sensors"
/usr/bin/sensors -s >/dev/null 2>&1
eend ${?}
fi
}
stop() {
checkconfig || return 1
if [ "${LOADMODULES}" = "yes" -a -f /proc/modules ]; then
einfo "Unloading lm_sensors modules..."
for module in ${HWMON_MODULES}; do
ebegin " Unloading ${module}"
rmmod ${module} >/dev/null 2>&1
eend $?
done
for module in ${BUS_MODULES}; do
ebegin " Unloading ${module}"
rmmod ${module} >/dev/null 2>&1
eend $?
done
if [ -e /proc/sys/dev/sensors ] ; then
ebegin " Unloading i2c-proc"
rmmod i2c-proc >/dev/null 2>&1
eend $?
fi
fi
}
|