| 31 | | if grep -q sysfs /proc/mounts; then |
|---|
| 32 | | WITHSYS=1 |
|---|
| 33 | | else |
|---|
| 34 | | WITHSYS=0 |
|---|
| 35 | | fi |
|---|
| 36 | | |
|---|
| 37 | | if [ $WITHSYS == "0" ]; then |
|---|
| 38 | | # If sensors isn't supported by the kernel, try loading the module... |
|---|
| 39 | | [ -e /proc/sys/dev/sensors ] || /sbin/modprobe i2c-proc >/dev/null 2>&1 |
|---|
| 40 | | |
|---|
| 41 | | # Don't bother if /proc/sensors still doesn't exist, kernel doesn't have |
|---|
| 42 | | # support for sensors. |
|---|
| 43 | | [ -e /proc/sys/dev/sensors ] || exit 0 |
|---|
| 44 | | |
|---|
| 45 | | # If sensors was not already running, unload the module... |
|---|
| 46 | | [ -e /var/lock/subsys/lm_sensors ] || /sbin/modprobe -r i2c-proc >/dev/null 2>&1 |
|---|
| 47 | | fi |
|---|
| 48 | | |
|---|
| 49 | | CONFIG=/etc/sysconfig/lm_sensors |
|---|
| 50 | | [ -r "$CONFIG" ] || exit 0 |
|---|
| 51 | | grep '^MODULE_' $CONFIG >/dev/null 2>&1 || exit 0 |
|---|
| 52 | | |
|---|
| 53 | | # Load config file |
|---|
| 54 | | . "$CONFIG" |
|---|
| 55 | | |
|---|
| | 43 | # This functions checks if sensor support is compiled into the kernel, if |
|---|
| | 44 | # sensors are configured, and loads the config file |
|---|
| | 45 | check_sensors() { |
|---|
| | 46 | if grep -q sysfs /proc/mounts; then |
|---|
| | 47 | WITHSYS=1 |
|---|
| | 48 | else |
|---|
| | 49 | WITHSYS=0 |
|---|
| | 50 | fi |
|---|
| | 51 | |
|---|
| | 52 | if [ $WITHSYS == "0" ]; then |
|---|
| | 53 | # If sensors isn't supported by the kernel, try loading the module... |
|---|
| | 54 | [ -e /proc/sys/dev/sensors ] || /sbin/modprobe i2c-proc >/dev/null 2>&1 |
|---|
| | 55 | |
|---|
| | 56 | # Don't bother if /proc/sensors still doesn't exist, kernel doesn't have |
|---|
| | 57 | # support for sensors. |
|---|
| | 58 | if ! [ -e /proc/sys/dev/sensors ]; then |
|---|
| | 59 | echo -n "$1 $prog: kernel does not have sensors support" |
|---|
| | 60 | echo_failure |
|---|
| | 61 | echo |
|---|
| | 62 | exit 5 |
|---|
| | 63 | fi |
|---|
| | 64 | |
|---|
| | 65 | # If sensors was not already running, unload the module... |
|---|
| | 66 | [ -e /var/lock/subsys/lm_sensors ] || /sbin/modprobe -r i2c-proc >/dev/null 2>&1 |
|---|
| | 67 | fi |
|---|
| | 68 | |
|---|
| | 69 | CONFIG=/etc/sysconfig/lm_sensors |
|---|
| | 70 | if ! [ -r "$CONFIG" ] || ! grep '^MODULE_' $CONFIG >/dev/null 2>&1; then |
|---|
| | 71 | echo -n "$1 $prog: not configured, run sensors-detect" |
|---|
| | 72 | echo_warning |
|---|
| | 73 | echo |
|---|
| | 74 | exit 6 |
|---|
| | 75 | fi |
|---|
| | 76 | |
|---|
| | 77 | # Load config file |
|---|
| | 78 | . "$CONFIG" |
|---|
| | 79 | } |
|---|
| | 80 | |
|---|