X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=f8af3dbe095626c716961d3b1ae23993f81cf6d0;hp=fa5dd55fa102b24c0012de69a2d388834aa942ab;hb=refs%2Ftags%2F0.5-20;hpb=53c9c6b67bbf9bfcec6b5d96e110fbeef703b1cc diff --git a/autoconfig.functions b/autoconfig.functions index fa5dd55..f8af3db 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -937,9 +937,13 @@ fi # {{{ Start creating /etc/fstab with HD partitions and USB SCSI devices now config_fstab(){ + NOSWAP="" -checkbootparam "noswap" && NOSWAP="yes" -if checkbootparam "nofstab"; then +if checkbootparam "noswap" -o checkbootparam "forensic" ; then + NOSWAP="yes" +fi + +if checkbootparam "nofstab" -o checkbootparam "forensic" ; then ewarn "Skipping /etc/fstab creation as requested on boot commandline." ; eend 0 else checkbootparam "anyswap" && export ANYSWAP='yes' || export ANYSWAP="" @@ -1171,7 +1175,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() { @@ -1701,7 +1712,7 @@ fi } config_automount(){ -if checkbootparam noautoconfig ; then +if checkbootparam noautoconfig -o checkbootparam forensic ; then ewarn "Skipping running automount of device(s) labeled GRMLCFG as requested." ; eend 0 else if [ -z "$INSTALLED" ] ; then @@ -1979,6 +1990,58 @@ fi } # }}} +# {{{ SW-RAID +config_swraid(){ + if [ -z "$INSTALLED" ] ; then + # notice: checkbootparam "forensic" is just for users who don't know how to really use the bootoption + if checkbootparam "noraid" -o checkbootparam "forensic" -o checkbootparam "raid=noautodetect" ; 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 (disable via bootoption noraid):" + 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