Changeset 5179
- Timestamp:
- 04/16/08 13:18:36 (5 years ago)
- Location:
- lm-sensors/branches/lm-sensors-3.0.0
- Files:
-
- 2 modified
-
CHANGES (modified) (1 diff)
-
prog/pwm/pwmconfig (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/branches/lm-sensors-3.0.0/CHANGES
r5176 r5179 7 7 Late compute statements override early ones 8 8 Support virtual hwmon devices (#2309) 9 pwmconfig: Don't create the configuration file before it's needed 10 Don't preserve configuration file customizations 11 Fix permissions of the configuration file 9 12 sensors-detect: Add SMSC SCH5027D detection 10 13 Do not access I/O ports on PPC -
lm-sensors/branches/lm-sensors-3.0.0/prog/pwm/pwmconfig
r5163 r5179 10 10 # program has exited!!! 11 11 # 12 # Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>12 # Copyright (C) 2007-2008 Jean Delvare <khali@linux-fr.org> 13 13 # 14 14 # This program is free software; you can redistribute it and/or modify … … 502 502 echo -n 'What should be the path to your fancontrol config file (/etc/fancontrol)? ' 503 503 504 read X 505 if [ "$X" = "y" -o "$X" = "Y" -o "$X" = "" ] 506 then 507 X=/etc/fancontrol 508 fi 509 if [ -f $X ] 510 then 511 FCCONFIG=$X 512 else 513 echo -n "$X does not exist, shall I create it now (y)? " 514 read Y 515 if [ "$Y" = "y" -o "$Y" = "Y" -o "$Y" = "" ] 516 then 517 touch $X 518 chmod 0660 $X 519 chown root.root $X 520 FCCONFIG=$X 521 else 522 AskPath 523 fi 504 read FCCONFIG 505 if [ "$FCCONFIG" = "" ] 506 then 507 FCCONFIG="/etc/fancontrol" 524 508 fi 525 509 } … … 527 511 AskPath 528 512 513 function ClearConfig { 514 FCTEMPS="" 515 FCFANS="" 516 MINTEMP="" 517 MAXTEMP="" 518 MINSTART="" 519 MINSTOP="" 520 MINPWM="" 521 MAXPWM="" 522 } 523 529 524 function LoadConfig { 525 # Nothing to do 526 if [ ! -f "$1" ] 527 then 528 ClearConfig 529 return 0 530 fi 531 530 532 echo "Loading configuration from $1 ..." 531 533 INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL= *//g'` … … 546 548 then 547 549 echo "Configuration appears to be outdated, discarded" 548 FCTEMPS="" 549 FCFANS="" 550 MINTEMP="" 551 MAXTEMP="" 552 MINSTART="" 553 MINSTOP="" 554 MINPWM="" 555 MAXPWM="" 550 ClearConfig 556 551 return 0 557 552 fi … … 612 607 tmpfile=`mktemp -t pwmcfg.XXXXXXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; } 613 608 trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15 614 e grep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP|MINPWM|MAXPWM)' $FCCONFIG>$tmpfile609 echo "# Configuration file generated by pwmconfig, changes will be lost" >$tmpfile 615 610 echo -e "INTERVAL=$INTERVAL\nFCTEMPS=$FCTEMPS\nFCFANS=$FCFANS\nMINTEMP=$MINTEMP\nMAXTEMP=$MAXTEMP\nMINSTART=$MINSTART\nMINSTOP=$MINSTOP" >>$tmpfile 616 611 [ -n "$MINPWM" ] && echo "MINPWM=$MINPWM" >>$tmpfile 617 612 [ -n "$MAXPWM" ] && echo "MAXPWM=$MAXPWM" >>$tmpfile 618 613 mv $tmpfile $FCCONFIG 614 chmod +r $FCCONFIG 619 615 #check if file was written correctly 620 616 echo 'Configuration saved'
