config_cpu(): check for Virtual Box
authorMichael Prokop <mika@grml.org>
Wed, 11 Jul 2007 17:34:49 +0000 (19:34 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 11 Jul 2007 17:34:49 +0000 (19:34 +0200)
autoconfig.functions
debian/changelog

index 07c3344..10f05f2 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Klaus Knopper <knopper@knopper.net>, (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
 # Authors:       grml-team (grml.org), (c) Klaus Knopper <knopper@knopper.net>, (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Mit Jul 04 12:02:35 CEST 2007 [mika]
+# Latest change: Mit Jul 11 19:34:06 CEST 2007 [mika]
 ################################################################################
 
 # {{{ path, variables, signals, umask, zsh
 ################################################################################
 
 # {{{ path, variables, signals, umask, zsh
@@ -1251,7 +1251,7 @@ else
 
   # Disclaimer: sorry for the tons of if/then/else... but this makes sure we use:
   # * it only if we have the according kernel modules available
 
   # Disclaimer: sorry for the tons of if/then/else... but this makes sure we use:
   # * it only if we have the according kernel modules available
-  # * cpufreq only on laptops (check via /usr/sbin/laptop-detect)
+  # * cpufreq only on laptops (check via /usr/sbin/laptop-detect) and not inside Virtual Box
   # * current version of /etc/init.d/loadcpufreq from Debian (to stay in sync)
   #   -> parse output of the initscript and output it according to our look'n'feel
   # * our own cpufreq-detect.sh if /etc/init.d/loadcpufreq isn't present
   # * current version of /etc/init.d/loadcpufreq from Debian (to stay in sync)
   #   -> parse output of the initscript and output it according to our look'n'feel
   # * our own cpufreq-detect.sh if /etc/init.d/loadcpufreq isn't present
@@ -1259,6 +1259,13 @@ else
     ewarn "Skipping cpufreq setup as module dependencies are not fulfilled." ; eend 1
   else
     if /usr/sbin/laptop-detect 1>/dev/null 2>&1 ; then
     ewarn "Skipping cpufreq setup as module dependencies are not fulfilled." ; eend 1
   else
     if /usr/sbin/laptop-detect 1>/dev/null 2>&1 ; then
+       # Virtual Box supports ACPI and laptop-detect returns with '0', so check for it:
+       if [ -r /proc/acpi/battery/BAT0/info ] ; then
+          if grep -q 'OEM info:                innotek' /proc/acpi/battery/BAT0/info ; then
+             einfo 'Virtual Box detected, skipping cpufreq setup.' ; eend 0
+             return 0
+          fi
+       fi
        einfo "Detected Laptop - trying to use cpu frequency scaling:"
        eindent
        if [ -x /etc/init.d/loadcpufreq ] ; then
        einfo "Detected Laptop - trying to use cpu frequency scaling:"
        eindent
        if [ -x /etc/init.d/loadcpufreq ] ; then
index fa97332..9f3b455 100644 (file)
@@ -2,6 +2,8 @@ grml-autoconfig (0.7.6) unstable; urgency=low
 
   * config_lvm(): check for 'No volume groups found' as lvdisplay does
     not provide appropriate return code for us.
 
   * config_lvm(): check for 'No volume groups found' as lvdisplay does
     not provide appropriate return code for us.
+  * config_cpu(): Virtual Box supports ACPI and laptop-detect returns
+    with '0', so check for it and skip it.
 
  -- Michael Prokop <mika@grml.org>  Wed, 11 Jul 2007 19:25:25 +0200
 
 
  -- Michael Prokop <mika@grml.org>  Wed, 11 Jul 2007 19:25:25 +0200