Added tag 0.5-19 for changeset c0f5aaf754ba5abfc30c6b370430bf3e52effd07
[grml-autoconfig.git] / autoconfig.functions
index a1a2126..7a8e397 100755 (executable)
@@ -1171,7 +1171,14 @@ else
   elif [ ! -e /lib/modules/${KERNEL}/kernel/arch/i386/kernel/cpu/cpufreq -o ! -e /lib/modules/${KERNEL}/kernel/drivers/cpufreq ] ; then
     ewarn "Skipping CPU detection as module dependencies are not fulfilled." ; eend 1
   else
-    einfo "Detecting CPU: `awk -F: '/^processor/{printf " Processor"$2" is"};/^model name/{printf $2};/^vendor_id/{printf vendor};/^cpu MHz/{printf " %dMHz",int($2)};/^cache size/{printf ","$2" Cache"};/^$/{print ""}' /proc/cpuinfo 2>>$DEBUG` " ; eend 0
+    if [[ `grep -c processor /proc/cpuinfo` -gt 1 ]] ; then
+      einfo "Detecting CPU:"
+      CPU=$(awk -F: '/^processor/{printf "     Processor"$2" is"};/^model name/{printf $2};/^vendor_id/{printf vendor};/^cpu MHz/{printf " %dMHz",int($2)};/^cache size/{printf ","$2" Cache"};/^$/{print ""}' /proc/cpuinfo 2>>$DEBUG)
+      echo $CPU | sed 's/ \{1,\}/ /g'
+      eend 0
+    else
+      einfo "Detecting CPU: `awk -F: '/^processor/{printf " Processor"$2" is"};/^model name/{printf $2};/^vendor_id/{printf vendor};/^cpu MHz/{printf " %dMHz",int($2)};/^cache size/{printf ","$2" Cache"};/^$/{print ""}' /proc/cpuinfo 2>>$DEBUG` " ; eend 0
+    fi
     if /usr/sbin/laptop-detect ; then
     einfo "Detected Laptop - trying to use cpu frequency scaling:"
 #      loadcpumod() {
@@ -1451,7 +1458,13 @@ else
           amixer set Front 0% 1>/dev/null
        fi
     fi
-    aumix -w 0 -v 0 -p 0 -m 0 ; eend $?
+    ERROR=$(aumix -w 0 -v 0 -p 0 -m 0 2>&1) ; RC=$?
+    if [ -n "$ERROR" ] ; then
+       eindent
+       eerror "Problem muting sound devices: $ERROR"
+       eoutdent
+    fi
+    eend $RC
   elif [ -z "$INSTALLED" ]; then
       einfo "Setting mixer volumes to level ${WHITE}${VOL}${NORMAL}."
       # some IBM notebooks require the following stuff:
@@ -1461,7 +1474,13 @@ else
             amixer set Front ${VOL}% 1>/dev/null
          fi
       fi
-      aumix -w $VOL -v $VOL -p $VOL -m $VOL ; eend $?
+      ERROR=$(aumix -w $VOL -v $VOL -p $VOL -m $VOL 2>&1) ; RC=$?
+      if [ -n "$ERROR" ] ; then
+         eindent
+         eerror "Problem setting mixer volumes: $ERROR"
+         eoutdent
+      fi
+      eend $RC
   fi
 
 fi
@@ -1967,6 +1986,57 @@ fi
 }
 # }}}
 
+# {{{ SW-RAID
+config_swraid(){
+  if [ -z "$INSTALLED" ] ; then
+  if checkbootparam "noraid" -o checkbootparam "forensic" ; then
+     ewarn "Skipping search for SW-RAID as requested on boot commandline." ; eend 0
+  else
+    if ! [ -x /sbin/mdadm ] ; then
+       eerror "mdadm not available, can not execute it." ; eend 1
+    else
+
+       einfo "Searching for software RAID arrays:"
+       eindent
+         IFSOLD=${IFS:-}
+         IFS='
+'
+         for line in $(mdadm --assemble --scan --auto=yes --symlink=no 2>&1) ; do
+             case $line in
+               *'No arrays found'*)
+                 ewarn "$line" ; eend 0
+                 ;;
+               *)
+                 einfo "$line" ; eend 0
+                 ;;
+             esac
+         done
+         IFS=$IFSOLD
+       eoutdent
+
+       if [ -r /proc/mdstat ] ; then
+          eindent
+          MDSTAT=$(grep '^md[0-9]' /proc/mdstat)
+          if [ -z "$MDSTAT" ] ; then
+             ewarn "No active arrays found" ; eend 0
+          else
+             IFSOLD=${IFS:-}
+             IFS='
+'
+             for line in $(grep '^md[0-9]' /proc/mdstat) ; do
+                 einfo "active arrays: $line" ; eend 0
+             done
+             IFS=$IFSOLD
+          fi
+          eoutdent
+       fi
+
+     fi # is /sbin/mdadm executable?
+  fi # check for bootoptions
+  fi # run only in live-cd mode
+}
+# }}}
+
 # {{{ debnet: setup network based on an existing one found on a partition
 config_debnet(){
 if checkbootparam "debnet" ; then