--- trunk/installer/hwdetection.sh 2007/09/12 18:36:50 573 +++ trunk/installer/hwdetection.sh 2007/09/12 19:02:39 576 @@ -5,9 +5,24 @@ # get_hwinfo $hw_item get_hwinfo() { + local enable_desc="0" + + if [[ $1 = --with-description ]] || [[ $1 = -d ]] + then + enable_desc=1 + shift + fi + local item="$1" local all local i + + # handle special items + case ${item} in + memory) get_hwinfo_memory; return ;; + smp) get_hwinfo_smp; return ;; + esac + all=$(hwinfo --short --"${item}") declare -i i=0 @@ -17,10 +32,32 @@ (( i++ )) [ ${i} -eq 1 ] && continue - echo "${device};${description}" + if [[ ${enable_desc} = 1 ]] + then + echo "${device};${description}" + else + echo "${device}" + fi done <<< "${all}" } + +# special memory case +get_hwinfo_memory() +{ + local memory=$(hwinfo --memory | grep "Memory Size" | cut -d: -f2 | sed "s:\ ::") + echo "${memory}" +} + + +# special smp case +get_hwinfo_smp() +{ + local smp=$(hwinfo --smp | grep "SMP support:" | cut -d: -f2 | sed "s:\ ::") + echo "${smp}" +} + + # get_driver_modules $hw_item get_driver_modules() { @@ -44,7 +81,7 @@ local i for i in $(hwinfo --"${item}" | grep "Driver Modules:" | cut -d: -f2 ) do - eval $(echo "${i}" | sed -e "s:\":modules=\"\${modules}\ :" -e "s:\",\ \":\ :") + eval $(echo "${i}" | sed -e "s:\":modules=\"\${modules}\ :" -e "s:,:\ :") done echo "${modules}" } @@ -151,7 +188,7 @@ #get_driver_modules all # network -#get_hwinfo netcard +#get_hwinfo --with-description netcard #get_driver_modules netcard #get_hwinfo disk