Changeset 5770 for lm-sensors/trunk/prog/pwm/fancontrol
- Timestamp:
- 09/16/09 17:57:53 (3 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/prog/pwm/fancontrol (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/prog/pwm/fancontrol
r5766 r5770 4 4 # Supported Linux kernel versions: 2.6.5 and later 5 5 # 6 # Version 0. 696 # Version 0.70 7 7 # 8 8 # Usage: fancontrol [CONFIGFILE] 9 9 # 10 10 # Dependencies: 11 # bash, egrep, sed, cut, sleep, lm_sensors :)11 # bash, egrep, sed, cut, sleep, readlink, lm_sensors :) 12 12 # 13 13 # Please send any questions, comments or success stories to … … 56 56 # grep configuration from file 57 57 INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'` 58 DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'` 59 DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'` 58 60 FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'` 59 61 MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'` … … 153 155 } 154 156 157 function DevicePath() 158 { 159 if [ -h "$1/device" ] 160 then 161 readlink -f "$1/device" | sed -e 's/^\/sys\///' 162 fi 163 } 164 165 function DeviceName() 166 { 167 if [ -r "$1/name" ] 168 then 169 cat "$1/name" | sed -e 's/[[:space:]=]/_/g' 170 elif [ -r "$1/device/name" ] 171 then 172 cat "$1/device/name" | sed -e 's/[[:space:]=]/_/g' 173 fi 174 } 175 176 function ValidateDevices() 177 { 178 local OLD_DEVPATH="$1" OLD_DEVNAME="$2" outdated=0 179 local entry device name path 180 181 for entry in $OLD_DEVPATH 182 do 183 device=`echo "$entry" | sed -e 's/=[^=]*$//'` 184 path=`echo "$entry" | sed -e 's/^[^=]*=//'` 185 186 if [ "`DevicePath "$device"`" != "$path" ] 187 then 188 echo "Device path of $device has changed" 189 outdated=1 190 fi 191 done 192 193 for entry in $OLD_DEVNAME 194 do 195 device=`echo "$entry" | sed -e 's/=[^=]*$//'` 196 name=`echo "$entry" | sed -e 's/^[^=]*=//'` 197 198 if [ "`DeviceName "$device"`" != "$name" ] 199 then 200 echo "Device name of $device has changed" 201 outdated=1 202 fi 203 done 204 205 return $outdated 206 } 207 155 208 # Check that all referenced sysfs files exist 156 209 function CheckFiles { … … 233 286 cd $DIR 234 287 288 # Check for configuration change 289 if [ -z "$DEVPATH" -o -z "$DEVNAME" ] 290 then 291 echo "Configuration is too old, please run pwmconfig again" 292 exit 1 293 fi 294 if ! ValidateDevices "$DEVPATH" "$DEVNAME" 295 then 296 echo "Configuration appears to be outdated, please run pwmconfig again" 297 exit 1 298 fi 235 299 CheckFiles || exit 1 236 300
