--- mage/branches/alx-0_6_0/include/alx.minc 2011/05/11 21:16:12 2067 +++ mage/branches/alx-0_6_0/include/alx.minc 2011/06/30 15:25:12 2518 @@ -20,6 +20,16 @@ done } +add_conf_prot_ignore() +{ + local i + + 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() @@ -29,8 +39,10 @@ local i local rootfs local grubroot + local grubopts local OLD_IFS local grubconf="/boot/grub/grub.conf" + local pass KERNEL_IMAGE="$1" KERNEL_DESCRIPTION="$2" @@ -67,28 +79,42 @@ 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} echo "timeout 3" >> ${grubconf} - # using roots current password - echo "password --md5 $(cat /etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} + # using roots current password if one was set + pass="$(grep '^root:' /etc/shadow | cut -d: -f2)" + # or fallback to a default password + [[ -z ${pass} ]] && pass="$1$oc/rCMuc$ZodLQSj6N5zYIJtOBg.RT/" + echo "password --md5 ${pass}" >> ${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} + echo "kernel ${grubroot}/boot/${KERNEL_IMAGE} ${rootfs} quiet ${grubopts} alx-reset-settings" >> ${grubconf} } ## compat