--- phase2.backend 2003/07/25 18:20:38 1.47 +++ phase2.backend 2003/09/10 22:49:00 @@ -31,7 +31,7 @@ lba32=false extraliloopts="" finalshell=false -secondarybootloader=false +bootloadertarget="" smp=false dhcp=false disk=none @@ -189,10 +189,8 @@ if [ "$diskset" = " " ] ; then # This section will only ever be executed if no disk was found by the # installer and the user punted on the nice full-screen driver - # selection provided by anaconda. Try aic7xxx by default. + # selection provided by anaconda. modpath=`echo ${instroot}/lib/modules/*/kernel/drivers` - echo "Trying aic7xxx driver..." - MODPATH=$modpath insmod aic7xxx while ! grep -q ' sd$' /proc/devices ; do echo echo "No IDE drive found; a SCSI driver is required to proceed." @@ -331,7 +329,8 @@ case "$response" in y*|Y*) echo "The default boot loader for the Athena release you are installing" - echo "is ${bootloader}, installed in the MBR of your primary disk." + echo "is ${bootloader}, installed in the MBR of the disk containing either" + echo "your boot partition (if you have one), or your root partition (otherwise)." echo -n "Would you like a different boot loader configuration? [y/N]: " read subresponse case "${subresponse}" in @@ -369,15 +368,18 @@ echo "The default boot loader location is the Master Boot Record of your primary" echo "disk. You can also choose to install it on your boot (if it exists) or" echo "root (otherwise) partition, which will enable you to configure another boot" - echo "loader in the MBR which will then invoke the linux boot loader." - echo "Selecting this option means your system WILL NOT BOOT into Athena linux" - echo "without external intervention." - echo ; echo "Would you like your boot loader installed in the boot/root partition" - echo -n "instead of the MBR? [y/N]: " + echo "loader in the MBR which will then invoke the linux boot loader," + echo "or even somewhere entirely different." + echo "Selecting this option usually means your system WILL NOT BOOT into Athena" + echo "linux without additional work." + echo ; echo "Would you like to use a non-default boot loader location" + echo -n "instead of the MBR of the boot/root disk? [y/N]: " read subresponse case "${subresponse}" in y*|Y*) - secondarybootloader=true + bootloadertarget="custom" + echo "You will be prompted for the boot loader location after" + echo "disk formatting." ;; esac fi @@ -710,6 +712,7 @@ echo "LILO's lba32 option WILL be set." fi disk=${bootpartition%%[0-9]*} + # Perhaps more sophisticated checking is called for here... for p in "$swappartition" "$cachepartition" "$rootpartition" "$bootpartition" ; do if [ -z "$p" ] || ! awk '{print $4}' < /proc/partitions|grep -q "^${p}$"; then @@ -754,6 +757,31 @@ rootpartition=${disk}7 fi +#### End of disk setup. + +### Choose boot loader target: +if [ "${bootloader}" = lilo -o "${bootloader}" = grub ] ; then + if [ custom != "$bootloadertarget" ] ; then + bootloadertarget=${disk} + else + while [ custom = "$bootloadertarget" ] ; do + echo ; echo "Enter the name of the device where the boot loader" + echo "is to be installed, or just press return to use the" + echo -n "boot/root partition: " + read bootloadertarget + if [ -z "${bootloadertarget}" ] ; then + bootloadertarget=${bootpartition} + elif grep -q " ${bootloadertarget} " /proc/partitions ; then + echo "Installing ${bootloader} on ${bootloadertarget}." + else + echo "${bootloadertarget} not found. Try again." + bootloadertarget=custom + fi + done + fi + echo "Installing boot loader on ${bootloadertarget}." +fi + ### Find likely non-Athena partitions and inquire as to whether they ### should be boot options. if [ "$disk_setup" != public ]; then @@ -1008,14 +1036,10 @@ # Fake /etc/mtab on the install target so that df, and thus the # grub-install script, will work. grep ${root} /etc/mtab|sed -e "s+${root}+/+" -e "s+//+/+" > ${root}/etc/mtab - # Install grub on our target disk. - if [ "${secondarybootloader}" = true ] ; then - chroot ${root} /sbin/grub-install /dev/${bootpartition} - else - # Save old MBR before we write over it. - dd if=/dev/${disk} of=${root}/boot/grub/old-MBR bs=512 count=1 - chroot ${root} /sbin/grub-install /dev/${disk} - fi + # Install grub on our target disk, and save old MBR before we write over it. + dd if=/dev/${bootloadertarget} of=${root}/boot/grub/old-MBR bs=512 count=1 + chroot ${root} /sbin/grub-install /dev/${bootloadertarget} + # Paths need to be relative to the partition in which grub is installed. if [ ${bootpartition} = ${rootpartition} ]; then boot="/boot" @@ -1082,13 +1106,8 @@ extraliloopts="${extraliloopts} lba32" fi - if [ "${secondarybootloader}" = true ] ; then - lilobootpartition=${bootpartition} - else - lilobootpartition=${disk} - fi cat > ${root}/etc/lilo.conf.simple << EOF -boot=/dev/${lilobootpartition} +boot=/dev/${bootloadertarget} map=/boot/map install=/boot/boot.b prompt @@ -1105,7 +1124,7 @@ cat /tmp/lilo.addon >> ${root}/etc/lilo.conf # Run lilo, with successive fallback and a final punt to a shell. - if ${root}/sbin/lilo -r ${root} ; then + if chroot ${root} lilo ; then rm ${root}/etc/lilo.conf.simple else echo "Problems occured installing the boot loader (LILO); attempting to install" @@ -1116,7 +1135,7 @@ printf "\a" ; sleep 1 ; printf "\a" ; sleep 1 ; printf "\a" ; sleep 60 mv ${root}/etc/lilo.conf ${root}/etc/lilo.conf.broken mv ${root}/etc/lilo.conf.simple ${root}/etc/lilo.conf - if ! ${root}/sbin/lilo -r ${root} ; then + if ! chroot ${root} lilo ; then echo "BUGHALT. FIND A WIZARD." echo "THE INSTALL HAS DIED AND CANNOT BE REVIVED WITHOUT EXPERT ATTENTION." echo "SEE THE ERROR MESSAGES ABOVE AND ${root}/etc/lilo.conf." @@ -1289,10 +1308,27 @@ # which the card claims to support don't work on about 15% of the # cards. cp ${installer}/XF86Config-4.g400 ${root}/etc/X11/XF86Config + elif lspci -n|grep -q 8086:7125 && lspci -n|grep -q 10de:002d && \ + chroot ${root} redhat-config-xfree86 --reconfig \ + --set-depth=24 --set-resolution=1280x1024 --set-driver=nv \ + 2> /tmp/xconfig.err \ + && test -f ${root}/etc/X11/XF86Config ; then + echo "Forcing nv driver for gx110 configuration." + # Force NVidia driver on gx110's; redhat-config-xfree86 doesn't deal + # correctly with multiple video cards non-interactively. + if grep -q "HorizSync: None" /tmp/xconfig.err || \ + grep -q "ddcprobe returned bogus values" /tmp/xconfig.err ; then + echo "Automated X configuration had problems; adding 1024x768 mode." + sed -e 's/Modes /Modes "1024x768" /' \ + ${root}/etc/X11/XF86Config > ${root}/etc/X11/XF86Config.new + mv -f ${root}/etc/X11/XF86Config.new ${root}/etc/X11/XF86Config + fi elif chroot ${root} redhat-config-xfree86 --reconfig \ --set-depth=24 --set-resolution=1280x1024 2> /tmp/xconfig.err \ && test -f ${root}/etc/X11/XF86Config ; then - if grep -q "HorizSync: None" /tmp/xconfig.err ; then + if grep -q "HorizSync: None" /tmp/xconfig.err || \ + grep -q "ddcprobe returned bogus values" /tmp/xconfig.err ; then + echo "Automated X configuration had problems; adding 1024x768 mode." sed -e 's/Modes /Modes "1024x768" /' \ ${root}/etc/X11/XF86Config > ${root}/etc/X11/XF86Config.new mv -f ${root}/etc/X11/XF86Config.new ${root}/etc/X11/XF86Config