blob: 0f71222c685d187695c7089f517837e04660e471 (
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
|
#!/sbin/runscript
start() {
if ! [ -f /etc/conf.d/lm_sensors ] ; then
eerror "/etc/conf.d/lm_sensors does not exist, try running sensors-detect"
return 1
fi
. /etc/conf.d/lm_sensors
if [ -z "${MODULE_0}" ] ; then
eerror "MODULE_0 is not set in /etc/conf.d/lm_sensors, try running sensors-detect"
return 1
fi
ebegin "Loading lm_sensors modules"
eend $?
if ! [ -e /proc/sys/dev/sensors ] ; then
ebegin " Loading i2c-proc"
modprobe i2c-proc &>/dev/null
eend $?
fi
[ -e /proc/sys/dev/sensors ] || return 1
i=0
while true; do
module=`eval echo '$'MODULE_${i}`
if [ -z "${module}" ] ; then
break
fi
ebegin " Loading ${module}"
modprobe ${module} &>/dev/null
eend $?
i=$((i+1))
done
return 0
}
stop() {
if ! [ -f /etc/conf.d/lm_sensors ] ; then
eerror "/etc/conf.d/lm_sensors does not exist, try running sensors-detect"
return 1
fi
. /etc/conf.d/lm_sensors
if [ -z "${MODULE_0}" ] ; then
eerror "MODULE_0 is not set in /etc/conf.d/lm_sensors, try running sensors-detect"
return 1
fi
ebegin "Removing lm_sensors modules"
eend $?
# find the highest possible MODULE_ number
i=0
while true; do
module=`eval echo '$'MODULE_${i}`
if [ -z "${module}" ] ; then
break
fi
i=$((i+1))
done
while [ ${i} -gt 0 ]; do
i=$((i-1))
module=`eval echo '$'MODULE_${i}`
ebegin " Removing ${module}"
rmmod ${module} &>/dev/null
eend $?
done
# should we actually remove i2c-proc???
ebegin " Removing i2c-proc"
rmmod i2c-proc &>/dev/null
eend $?
return 0
}
|