config_mixer(): Add 'no soundcard?' to aumix error message
[grml-autoconfig.git] / autoconfig.functions
index 06e5168..9218b7b 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.
-# 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
@@ -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
-  # * 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
@@ -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
+       # 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
@@ -1497,7 +1504,7 @@ else
       ERROR=$(aumix -w $VOL -v $VOL -p $VOL -m $VOL 2>&1) ; RC=$?
       if [ -n "$ERROR" ] ; then
          eindent
-         eerror "Problem setting mixer volumes: $ERROR"
+         eerror "Problem setting mixer volumes: $ERROR (no soundcard?)"
          eoutdent
       fi
       eend $RC
@@ -2097,7 +2104,7 @@ config_lvm(){
     if ! [ -x /sbin/lvm -a -x /etc/init.d/lvm2 -a -x /sbin/lvdisplay ] ; then
        eerror "LVM not available, can not execute it." ; eend 1
     else
-       if lvdisplay 1>/dev/null 2>&1 ; then
+       if lvdisplay 2>&1 | grep -v 'No volume groups found' 1>/dev/null 2>&1 ; then
           einfo "You seem to have logical volumes (LVM) on your system."
           eindent
           einfo "Just run 'Start lvm2' to activate them or boot using 'lvm' as bootoption for autostart."