From 493dfc88f8fe5fd540fb08bb5750dc6aa95aa9d9 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 2 Nov 2006 15:45:31 +0100 Subject: [PATCH] added config_swraid for sw-raid support on live-cd --- autoconfig | 1 + autoconfig.functions | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++- autoconfig.small | 1 + debian/changelog | 7 +++++++ grml-autoconfig | 2 ++ 5 files changed, 63 insertions(+), 1 deletion(-) diff --git a/autoconfig b/autoconfig index eeeae27..95404d9 100644 --- a/autoconfig +++ b/autoconfig @@ -109,6 +109,7 @@ CONFIG_SETKEYCODES='yes' # run setkeycodes when bootoption setkeycodes foun CONFIG_SMALL='yes' # use a less "bloat" /etc/inittab for small computer with less RAM CONFIG_SPLASH='yes' # bootsplash CONFIG_SSH='yes' # check for bootparam ssh +CONFIG_SWRAID='yes' # check for software raid devices [only in live-mode] CONFIG_SWSPEAK='yes' # run software synthesizer via speakup CONFIG_TESTCD='yes' # CD checker CONFIG_TIME='yes' # set clock, check for bootparam utc/gmt [only in live-mode] diff --git a/autoconfig.functions b/autoconfig.functions index dbe9d63..7a8e397 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -1174,7 +1174,7 @@ else 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' + 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 @@ -1986,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 diff --git a/autoconfig.small b/autoconfig.small index 76e199a..44203d5 100644 --- a/autoconfig.small +++ b/autoconfig.small @@ -109,6 +109,7 @@ CONFIG_SETKEYCODES='yes' # run setkeycodes when bootoption setkeycodes foun CONFIG_SMALL='yes' # use a less "bloat" /etc/inittab for small computer with less RAM CONFIG_SPLASH='no' # bootsplash CONFIG_SSH='yes' # check for bootparam ssh +CONFIG_SWRAID='yes' # check for software raid devices [only in live-mode] CONFIG_SWSPEAK='no' # run software synthesizer via speakup CONFIG_TESTCD='yes' # CD checker CONFIG_TIME='yes' # set clock, check for bootparam utc/gmt [only in live-mode] diff --git a/debian/changelog b/debian/changelog index 9336e2d..0635552 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +grml-autoconfig (0.5-19) unstable; urgency=low + + * Added function config_swraid ($CONFIG_SWRAID) for detection + of software raid arrays, running only in live-cd mode. + + -- Michael Prokop Wed, 1 Nov 2006 14:14:44 +0100 + grml-autoconfig (0.5-18) unstable; urgency=low * config_cpu: beautify "Detecting CPU" for SMP systems. diff --git a/grml-autoconfig b/grml-autoconfig index 337c3fc..9505e22 100755 --- a/grml-autoconfig +++ b/grml-autoconfig @@ -114,6 +114,8 @@ checkvalue $CONFIG_FAST && config_fast checkvalue $CONFIG_ENVIRONMENT && config_environment +checkvalue $CONFIG_SWRAID && config_swraid + # No kernel messages while probing modules echo "0" > /proc/sys/kernel/printk -- 2.1.4