On Tue, May 29, 2007 at 08:58:46PM +0200, Petter Reinholdtsen wrote: > > This patch has been tested in Debian Edu a few days now, and seem to > work as it should. It is available from > <URL:http://ftp.skolelinux.org/skolelinux/pool/local/c/cpufrequtils/>. > > I can NMU this bug into unstable if you, the maintainer, agree with > the change but is still rather busy. Just let me know.
Hi, the following patch is what I'd apply instead. Comments? (it contains also some cleanup from old commented code) diff --git a/debian/cpufrequtils.init b/debian/cpufrequtils.init index 417933d..e43f397 100644 --- a/debian/cpufrequtils.init +++ b/debian/cpufrequtils.init @@ -39,17 +39,23 @@ CPUFREQ_OPTIONS="" # MAX_SPEED=1000 # MIN_SPEED=500 -ENABLE="false" +ENABLE="true" GOVERNOR="ondemand" MAX_SPEED=0 MIN_SPEED=0 +check_governor_avail() { + info="/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors" + if [ -f $info ] && grep -q $GOVERNOR $info ; then + return 0; + fi + return 1; +} + [ -x $CPUFREQ_SET ] || exit 0 if [ -f /etc/default/cpufrequtils ] ; then . /etc/default/cpufrequtils -else - ENABLE="false" fi # if not enabled then exit gracefully @@ -63,14 +69,8 @@ if [ $MIN_SPEED != '0' ] ; then CPUFREQ_OPTIONS="$CPUFREQ_OPTIONS --min $MIN_SPEED" fi -#FAIL_MESG="" if [ -n "$GOVERNOR" ] ; then - #GOVERNOR=$($CPUFREQ_INFO -g | sed -ne "s/.*\($GOVERNOR\).*/\1/p") - #if [ -n "$GOVERNOR" ] ; then - CPUFREQ_OPTIONS="$CPUFREQ_OPTIONS --governor $GOVERNOR" - #else - # FAIL_MESG="governor not available" - #fi + CPUFREQ_OPTIONS="$CPUFREQ_OPTIONS --governor $GOVERNOR" fi CPUS=$(sed -ne 's/^processor[[:space:]]*: \([0-9]\+\)$/\1/p' /proc/cpuinfo) @@ -78,13 +78,16 @@ RETVAL=0 case "$1" in start|force-reload|restart|reload) log_action_begin_msg "$DESC: Setting $GOVERNOR CPUFreq governor" - for cpu in $CPUS ; do - # if [ $(CPUFREQ_INFO -a --cpu $cpu) -eq $cpu ] ; then - log_progress_msg "CPU${cpu} " - $CPUFREQ_SET --cpu $cpu $CPUFREQ_OPTIONS 2>&1 > /dev/null || RETVAL=$? - # fi - done - log_action_end_msg $RETVAL "$FAIL_MESG" + if check_governor_avail ; then + for cpu in $CPUS ; do + log_progress_msg "CPU${cpu} " + $CPUFREQ_SET --cpu $cpu $CPUFREQ_OPTIONS 2>&1 > /dev/null || \ + RETVAL=$? + done + log_action_end_msg $RETVAL "" + else + log_action_end_msg $RETVAL "Disabled, governor not available" + fi ;; stop) ;; -- mattia :wq! -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]