--- alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in 2011/08/11 14:58:15 2736 +++ alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in 2011/09/14 11:11:55 3199 @@ -38,6 +38,9 @@ GRUBLEGACYOPTS="" GRUB2OPTS="" +# fdisk options +FDISKPARTIONBELOW256MB=0 + # default specialdevices SPECIALDEVICE="" @@ -204,6 +207,8 @@ run_hardware_detection case "${SPECIALDEVICE}" in zotac) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;; + "rangee+256mb") echo " \n\n\n \\Z2Rangee Device mit Flashdisk (=< 256MB) erkannt!\\Zn \\" >> ${hwtmp} ;; + rangee) echo " \n\n\n \\Z2Rangee Device erkannt!\\Zn \\" >> ${hwtmp} ;; *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;; esac @@ -435,10 +440,14 @@ ################################################# run_hardware_detection() { + local hwinfo + + hwinfo="$(hwinfo --bios --storage)" + # check for special devices/clients: # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd local removable=0 - if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]] + if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] then for i in /sys/block/[hs]d*/removable do @@ -452,25 +461,86 @@ export GRUBLEGACYOPTS="rootdelay=8" export SPECIALDEVICE="zotac" fi + + # check for special devices/clients: + # if a rangee and disk ist smaller then 256mb move partion one block further ahead + if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]] + then + # for a rangee always define partion startblock +1 + export FDISKPARTIONBELOW256MB="1" + export SPECIALDEVICE="rangee" + export GRUBLEGACYOPTS="" + fi +} + +hdd_size_below_256mb() +{ + local hdd="$1" + local size + local retval + [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!" + + size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') + if [[ ${size} -le 257000000 ]] + then + retval="0" + else + retval="1" + fi + + return "${retval}" } setup_hdd_partitions_auto() { ROOTHDD="${HDD}1" + # run this only if FDISKPARTITIONBELOW256MB is not already 1 + if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] + then + if hdd_size_below_256mb ${HDD} + then + FDISKPARTIONBELOW256MB=1 + else + FDISKPARTIONBELOW256MB=0 + fi + fi + ## delete disk dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die - ## setup one bootable partition - #1. n= new disk - #2. p= primary disk - #3. 1= first partition - #4. ''= default sector start - #5. ''= defaul sector end - #6. a= bootable flag - #7. 1= boot flag for partition 1 - #8. w= write/quit - fdisk ${HDD} &> /dev/null << EOF + if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] + then + ## setup one bootable partition + #1. n= new disk + #2. p= primary disk + #3. 1= first partition + #4. 2= default sector start // small disk needs more space for grub2 mbr sector + #5. ''= defaul sector end + #6. a= bootable flag + #7. 1= boot flag for partition 1 + #8. w= write/quit + fdisk ${HDD} &> /dev/null << EOF +n +p +1 +2 + +a +1 +w +EOF + else + ## setup one bootable partition + #1. n= new disk + #2. p= primary disk + #3. 1= first partition + #4. ''= default sector start + #5. ''= defaul sector end + #6. a= bootable flag + #7. 1= boot flag for partition 1 + #8. w= write/quit + fdisk ${HDD} &> /dev/null << EOF n p 1 @@ -480,6 +550,7 @@ 1 w EOF + fi } setup_hdd_partitions_manuell()