--- mage/branches/alx-0_6_0/include/alx.minc 2011/05/06 17:16:39 1921 +++ mage/branches/alx-0_6_0/include/alx.minc 2011/06/08 09:13:05 2205 @@ -20,49 +20,26 @@ done } -# updates /boot/grub/grub.conf with given params -# example: alx_grub_update kernel-image-name description -alx_grub_update() +add_conf_prot_ignore() { - local KERNEL_IMAGE - local KERNEL_DESCRIPTION - local old_image - - KERNEL_IMAGE="$1" - KERNEL_DESCRIPTION="$2" - - # some checks - if [ -z "${KERNEL_IMAGE}" ] - then - echo "At least a kernel-image must be given" - return 1 - fi - - [ -z "${KERNEL_DESCRIPTION}" ] && KERNEL_DESCRIPTION="${KERNEL_IMAGE}" - - if [ ! -f /boot/grub/grub.conf ] - then - echo "/boot/grub/grub.conf not found" - return 1 - fi - - # fix description - sed -i "s:^\(title=\).*:\1${KERNEL_DESCRIPTION}:" /boot/grub/grub.conf + local i - # fix kernel image - old_image="$(basename $(cat /boot/grub/grub.conf|grep kernel |cut -d' ' -f2))" - sed -i "s:${old_image}:${KERNEL_IMAGE}:" /boot/grub/grub.conf + for i in $@ + do + export CONFIG_PROTECT_IGNORE="${CONFIG_PROTECT_IGNORE} ${i}" + done } # updates /boot/grub/grub.conf with given params # example: alx_grub_update kernel-image-name description -alx_grub_update_new() +alx_grub_update() { local KERNEL_IMAGE local KERNEL_DESCRIPTION local i local rootfs local grubroot + local grubopts local OLD_IFS local grubconf="/boot/grub/grub.conf" @@ -101,6 +78,17 @@ done IFS="${OLD_IFS}" + # check for special hardware + if [[ -x $(which hwinfo) ]] + then + # zotac devices + if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]] + then + grubopts="rootdelay=8" + echo "Special device 'ZOTAC' detected!" + fi + fi + # fix description : > ${grubconf} echo "default 0" >> ${grubconf} @@ -108,70 +96,27 @@ # using roots current password echo "password --md5 $(cat /etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} echo >> ${grubconf} - acho "# normal boot" >> ${grubconf} + echo "# normal boot" >> ${grubconf} echo "title ${KERNEL_DESCRIPTION}" >> ${grubconf} echo "root ${grubroot}" >> ${grubconf} - echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet" >> ${grubconf} + echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts}" >> ${grubconf} echo >> ${grubconf} echo "# admin boots" >> ${grubconf} echo "title ${KERNEL_DESCRIPTION} - Re-run hardware-detection" >> ${grubconf} echo "lock" >> ${grubconf} echo "root ${grubroot}" >> ${grubconf} - echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet hardware-auto-detection" >> ${grubconf} + echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts} hardware-auto-detection" >> ${grubconf} echo >> ${grubconf} echo "title ${KERNEL_DESCRIPTION} - Reset *all* local settings" >> ${grubconf} echo "lock" >> ${grubconf} echo "root ${grubroot}" >> ${grubconf} - echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet alx-reset-settings" >> ${grubconf} -} - -# checks if compilation should be against alx -target_alx_dev() -{ - local i - - if [ -n "${MAGE_TARGETS}" ] - then - for i in ${MAGE_TARGETS} - do - [[ ${i} = -alx_dev ]] && return 0 - - # alx-dev will always build when building target alx, - # so target alx ist also allowed to be alx-dev - [[ ${i} = -alx ]] && return 0 - done - fi - - # nothing match, we are *not* on alx linux - return 1 -} - -# check if compilation should be against stripped down alx for livecds -target_alx_livecd() -{ - if [ -n "${MAGE_TARGETS}" ] - then - for i in ${MAGE_TARGETS} - do - [[ ${i} = alx_livecd ]] && return 0 - done - fi - - # nothing match, we are *not* on alx linux - return 1 + echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts} alx-reset-settings" >> ${grubconf} } -# check if compilation should be against stripped down alx -target_alx() +## compat +alx_grub_update_new() { - if [ -n "${MAGE_TARGETS}" ] - then - for i in ${MAGE_TARGETS} - do - [[ ${i} = -alx ]] && return 0 - done - fi - - # nothing match, we are *not* on alx linux - return 1 + echo -e "${COLYELLOW}alx_grub_update_new() is deprecated - please only use alx_grub_update() from now on${COLDEFAULT}" + alx_grub_update + echo -e "${COLYELLOW}alx_grub_update_new() is deprecated - please only use alx_grub_update() from now on${COLDEFAULT}" }