config_cpu: set ondemand governor only if available
[grml-autoconfig.git] / autoconfig.functions
index a4cc453..23574ef 100755 (executable)
@@ -1028,22 +1028,22 @@ if [ -x /etc/init.d/loadcpufreq ] ; then
       fi
    fi
 
-   rm -f $LOADCPUFREQ
+   rm -f "$LOADCPUFREQ"
 
    if [ -z "$SKIP_CPU_GOVERNOR" ] ; then
-     if grep -vq ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors; then
-       einfo "Loading cpufreq_ondemand"
-       modprobe cpufreq_ondemand
-       eend $?
+     if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ] ; then
+       if ! grep -q ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ; then
+         einfo "Ondemand governor not available for CPU(s), not modifying governor configuration"
+       else
+         einfo "Setting ondemand governor"
+         RC=0
+         for file in $(find /sys/devices/system/cpu/ -name scaling_governor 2>/dev/null) ; do
+           echo ondemand > $file || RC=1
+         done
+         eend $RC
+       fi
      fi
-
-     einfo "Setting ondemand governor"
-     RC=0
-     for file in $(find /sys/devices/system/cpu/ -name scaling_governor 2>/dev/null) ; do
-       echo ondemand > $file || RC=1
-     done
-     eend $RC
-   fi # cpu-governor
+   fi
 
    eoutdent
 fi
@@ -1425,7 +1425,13 @@ get_remote_file() {
        --read-timeout=10 ${SOURCE} -O ${TARGET} && return 0 || return 1
   }
   einfo "Trying to get ${WHITE}${TARGET}${NORMAL}"
-  counter=10
+
+  if checkbootparam 'getfile.retries' ; then
+    local counter="$(getbootparam 'getfile.retries' 2>>$DEBUG)"
+  else
+    local counter=10
+  fi
+
   while ! getconfig && [[ "$counter" != 0 ]] ; do
     echo -n "Sleeping for 1 second and trying to get config again... "
     counter=$(( counter-1 ))