--- trunk/installer/include/hwdetection.sh 2010/05/30 17:43:44 1026 +++ trunk/installer/include/hwdetection.sh 2010/05/30 17:49:14 1027 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/installer/include/hwdetection.sh,v 1.1 2008-09-24 10:54:00 niro Exp $ +# $Id$ ## hwdetection, needs >= sys-apps/hwinfo @@ -95,7 +95,7 @@ do eval $(echo "${i}" | sed -e "s:\":modules=\"\${modules}\ :" -e "s:,:\ :") done - echo "${modules}" + remove_duplicates "${modules}" } # remove_duplicates $list @@ -117,9 +117,17 @@ # remove all ':' and show the cleaned list # this way fixes double spaces also + local counter + declare -i counter=0 for i in $(echo ${fixed_list} | sed "s|:| |g") do - list+=" ${i}" + (( counter++ )) + if [[ ${counter} -eq 1 ]] + then + list="${i}" + else + list+=" ${i}" + fi done echo "${list}" @@ -128,12 +136,99 @@ get_x11_driver_modules() { local modules - modules="$(hwinfo --gfxcard | grep "XFree86 v4 Server Module:" | cut -d: -f2)" + modules="$(hwinfo --gfxcard | grep 'XFree86 v4 Server Module:' | sed 's/.*Module:\ \(.*\)/\1/')" # remove duplicates from list and show it remove_duplicates "${modules}" } +get_evdev_device_path() +{ + local device="$1" + local path + + case ${device} in + mouse|keyboard) true;; + *) die "unkown device";; + esac + + path="$(hwinfo --${device} | grep 'Device Files:' | sed 's:.*\(/dev/input/event[0-5]\).*:\1:')" + echo "${path}" +} + +# get_netcard_driver_modules device +# e.g. get_netcard_driver_modules eth0 +get_netcard_driver_modules() +{ + local device="$1" + local modules + + if [[ -z ${device} ]] + then + echo "Error: get_netcard_driver_module(): no device given" + return 1 + fi + + modules=$(hwinfo --netcard | grep -B1 "Device File: ${device}" | sed 's/.*Modules: \"\(.*\)\"/\1/;q') + remove_duplicates "${modules}" +} + +get_blkid_information() +{ + local partition="$1" + local variable="$2" + local method + + case $1 in + --uuid|-u) shift; method="-U"; partition="$1"; variable="$2" ;; + --label|-l) shift; method="-L"; partition="$1"; variable="$2" ;; + esac + + if [[ -z ${partition} ]] + then + echo "Error: get_get_blkid_information()(): no partition given" + return 1 + fi + + if [[ -z ${variable} ]] + then + echo "Error: get_get_blkid_information()(): no variable given" + return 1 + fi + + blkid -o value -s "${variable}" "${method}" "${partition}" +} + +get_fstype() +{ + local partition="$1" + if [[ -z ${partition} ]] + then + echo "Error: get_fstype(): no partition given" + return 1 + fi + + # does not work with uuids + #mount -f --guess-fstype ${partition} + + get_blkid_information ${partition} TYPE +} + +get_uuid() +{ + local partition="$1" + if [[ -z ${partition} ]] + then + echo "Error: get_uuid(): no partition given" + return 1 + fi + + # does not work with uuids + #mount -f --guess-fstype ${partition} + + get_blkid_information ${partition} UUID +} + # create_initrd {/path/to/initrd kernelversion } # when nothing given then /boot/initrd-$(uname -r).img $(uname -r) will be used # default config path is /etc/conf.d/mkinitrd @@ -145,6 +240,9 @@ local chroot #local root local modules + # enabled framebuffer modules as default + local framebuffer=1 + local uvesafb_config="/etc/modprobe.d/uvesafb.conf" # very basic getops for i in $* @@ -154,6 +252,7 @@ --initrd|-i) shift; initrd="$1" ;; --config|-c) shift; config="$1" ;; --kernelversion|-v) shift; kernel="$1" ;; + --nofb) shift; framebuffer=0 esac shift done @@ -165,6 +264,7 @@ if [[ ! -z ${INSTALL_ROOT} ]] then config="${INSTALL_ROOT}/${config}" + uvesafb_config="${INSTALL_ROOT}/${uvesafb_config}" chroot="chrooted" fi @@ -179,6 +279,29 @@ modules+=" $(grep ide_disk /proc/modules | cut -d' ' -f4 | sed '/-/d;s:,:\ :g')" fi + # add some generic modules + modules+=" sg_mod sg loop sr_mod sd_mod ide-cd ide-cd_mod ide-disk" + + # add generic framebuffer modules + if [[ ${framebuffer} = 1 ]] + then + modules+=" uvesafb" + + # setup modprobe conf too + [[ ! -d $(dirname ${uvesafb_config}) ]] && install -d $(dirname ${uvesafb_config}) + cat > ${uvesafb_config} << EOF +# This file sets the parameters for uvesafb module. +# The following format should be used: +# options uvesafb mode_option=x[-][@] scroll= ... +# +# For more details see: +# http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/fb/uvesafb.txt +# +EOF + # default config 1024x768 and 60 HZ + echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" >> ${uvesafb_config} + fi + # remove all duplicate modules modules="$(remove_duplicates ${modules})"