#!/bin/sh # # Copyright 1994, 1998, 1999 Patrick Volkerding, Moorhead, Minnesota USA # Copyright 2002, 2003 Slackware Linux, Inc, Concord, CA # All rights reserved. # 2006, 2007 - Modified by Jean-Philippe Guillemin for Zenwalk # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # TMP=/var/log/setup/tmp CONSOLETYPE=standard if mount | grep xfs 1> /dev/null 2> /dev/null ; then DEFAULT=" --default-item MBR " fi if [ -e /etc/fstab ] ; then SWAPDEVICE="$(grep 'swap' /etc/fstab | cut -d " " -f 1 | head -n1)" fi mount /proc 1> /dev/null 2> /dev/null # This is a different 'probe' than the function below. PROBE() { if [ -x /sbin/probe ]; then /sbin/probe -l elif fdisk -l | grep "Disk /dev/ide" 1> /dev/null 2> /dev/null ; then # no devfs yet for devs in /dev/hda /dev/hdb /dev/hdc /dev/hdd /dev/hde /dev/hdf /dev/hdg \ /dev/hdh /dev/hdi /dev/hdj /dev/hdk /dev/hdl /dev/hdm /dev/hdn /dev/hdo /dev/hdp \ /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi \ /dev/sdj /dev/sdk /dev/sdl /dev/sdm /dev/sdn /dev/sdo /dev/sdp ; do fdisk -l $devs 2> /dev/null done elif fdisk -l | grep "Disk /dev/scsi" 1> /dev/null 2> /dev/null ; then # no devfs yet for devs in /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi \ /dev/sdj /dev/sdk /dev/sdl /dev/sdm /dev/sdn /dev/sdo /dev/sdp ; do fdisk -l $devs 2> /dev/null done elif [ -z "`fdisk -l`" ]; then for devs in /dev/hda /dev/hdb /dev/hdc /dev/hdd /dev/hde /dev/hdf /dev/hdg \ /dev/hdh /dev/hdi /dev/hdj /dev/hdk /dev/hdl /dev/hdm /dev/hdn /dev/hdo /dev/hdp \ /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi \ /dev/sdj /dev/sdk /dev/sdl /dev/sdm /dev/sdn /dev/sdo /dev/sdp ; do fdisk -l $devs 2> /dev/null done else # We got output without /dev/ide or /dev/scsi, so it can probably be trusted: fdisk -l 2> /dev/null fi } # Menu to check if we want to use VESA framebuffer support: use_framebuffer() { if cat /proc/devices | grep "29 fb" 1> /dev/null ; then dialog --title "CONFIGURE LILO TO USE FRAME BUFFER CONSOLE?" \ --default-item 1024x768x64k \ --menu "It seems your kernel has support for frame buffer (FB) console. \ If we enable this, it will allow graphical screen at boot time. \ However, some very old video cards don't support frame buffer. \ Please choose your prefered console resolution:" 0 0 0 \ "800x600x64k" "FB - graphical splash screen - 800x600x64k" \ "1024x768x64k" "FB - graphical splash screen - 1024x768x64k" \ "1280x1024x64k" "FB - graphical splash screen - 1280x1024x64k" \ "800x600x256" "FB - boot logo - 800x600x256" \ "1024x768x256" "FB - boot logo - 1024x768x256" \ "1280x1024x256" "FB - boot logo - 1280x1024x256" \ "standard" "Use the standard VGA Linux console" \ 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then exit fi CONSOLETYPE="`cat $TMP/reply`" if [ "$CONSOLETYPE" = "1600x1200x16m" ]; then CONSOLENUM=799 elif [ "$CONSOLETYPE" = "1600x1200x64k" ]; then CONSOLENUM=798 elif [ "$CONSOLETYPE" = "1600x1200x32k" ]; then CONSOLENUM=797 elif [ "$CONSOLETYPE" = "1600x1200x256" ]; then CONSOLENUM=796 elif [ "$CONSOLETYPE" = "1280x1024x16m" ]; then CONSOLENUM=795 elif [ "$CONSOLETYPE" = "1280x1024x64k" ]; then CONSOLENUM=794 elif [ "$CONSOLETYPE" = "1280x1024x32k" ]; then CONSOLENUM=793 elif [ "$CONSOLETYPE" = "1280x1024x256" ]; then CONSOLENUM=775 elif [ "$CONSOLETYPE" = "1024x768x16m" ]; then CONSOLENUM=792 elif [ "$CONSOLETYPE" = "1024x768x64k" ]; then CONSOLENUM=791 elif [ "$CONSOLETYPE" = "1024x768x32k" ]; then CONSOLENUM=790 elif [ "$CONSOLETYPE" = "1024x768x256" ]; then CONSOLENUM=773 elif [ "$CONSOLETYPE" = "800x600x16m" ]; then CONSOLENUM=789 elif [ "$CONSOLETYPE" = "800x600x64k" ]; then CONSOLENUM=788 elif [ "$CONSOLETYPE" = "800x600x32k" ]; then CONSOLENUM=787 elif [ "$CONSOLETYPE" = "800x600x256" ]; then CONSOLENUM=771 elif [ "$CONSOLETYPE" = "640x480x16m" ]; then CONSOLENUM=786 elif [ "$CONSOLETYPE" = "640x480x64k" ]; then CONSOLENUM=785 elif [ "$CONSOLETYPE" = "640x480x32k" ]; then CONSOLENUM=784 elif [ "$CONSOLETYPE" = "640x480x256" ]; then CONSOLENUM=769 fi fi } # A function to ask for append= parameters. ask_append() { dialog --title "Optional kernel perameters" --inputbox \ "Some systems might require extra parameters to be passed to the kernel. \ If you need to pass parameters to the kernel enter them here. Most \ systems won't require any extra parameters. If you don't need any, just \ hit ENTER to continue.\n\ \n\ " 13 75 2> $TMP/reply RETVAL=$? return $RETVAL } # This function scans for bootable partitions (making some assumptions along # the way which may or may not be correct, but usually work), and sets up # LILO in either the superblock, or the MBR. simplelilo() { use_framebuffer; ask_append; APPEND="`cat $TMP/reply`" APPEND="splash=silent ${APPEND}" if [ "$SWAPDEVICE" ]; then APPEND="resume=${SWAPDEVICE} ${APPEND}" fi if [ -r $T_PX/etc/lilo.conf ]; then mv $T_PX/etc/lilo.conf $T_PX/etc/lilo.conf.orig fi dialog --title "SELECT LILO DESTINATION" $DEFAULT --menu \ "LILO can be installed to the following places:\n\ \n\ 1. The Master Boot Record of your first hard drive.\n\ 2. The superblock of your root Linux partition.\n\ \n\ Please choose a location:" \ 19 75 2 \ "MBR" "Install to Master Boot Record (standard)" \ "Root" "Install to superblock (not for use with XFS)" \ 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then exit fi TG="`cat $TMP/reply`" rm -r $TMP/reply if [ "$TG" = "MBR" ]; then LILO_TARGET="/dev/sda" elif [ "$TG" = "Root" ]; then LILO_TARGET=`echo $ROOT_DEVICE` fi cat << EOF > $T_PX/boot/boot_message.txt Welcome to the LILO Boot Loader! Please enter the name of the partition you would like to boot at the prompt below. The choices are: EOF cat << EOF > $T_PX/etc/lilo.conf # LILO configuration file # generated by 'liloconfig' # # Start LILO global section EOF if [ ! "$APPEND" = "" ]; then echo "append=\"$APPEND\"" >> $T_PX/etc/lilo.conf fi cat << EOF >> $T_PX/etc/lilo.conf boot = $LILO_TARGET bitmap=/boot/splash.bmp bmp-table=234p,348p,1,4 bmp-colors=220,0,,255,220, bmp-timer=539p,396p,220,0, prompt timeout = 50 # Override dangerous defaults that rewrite the partition table: change-rules reset EOF if [ "$CONSOLETYPE" = "standard" ]; then cat << EOF >> $T_PX/etc/lilo.conf # Normal VGA console vga = normal # VESA framebuffer console @ 1024x768x64k # vga=791 # VESA framebuffer console @ 1024x768x32k # vga=790 # VESA framebuffer console @ 1024x768x256 # vga=773 # VESA framebuffer console @ 800x600x64k # vga=788 # VESA framebuffer console @ 800x600x32k # vga=787 # VESA framebuffer console @ 800x600x256 # vga=771 # VESA framebuffer console @ 640x480x64k # vga=785 # VESA framebuffer console @ 640x480x32k # vga=784 # VESA framebuffer console @ 640x480x256 # vga=769 EOF else cat << EOF >> $T_PX/etc/lilo.conf # VESA framebuffer console @ $CONSOLETYPE vga = $CONSOLENUM # Normal VGA console # vga = normal # VESA framebuffer console @ 1024x768x64k # vga=791 # VESA framebuffer console @ 1024x768x32k # vga=790 # VESA framebuffer console @ 1024x768x256 # vga=773 # VESA framebuffer console @ 800x600x64k # vga=788 # VESA framebuffer console @ 800x600x32k # vga=787 # VESA framebuffer console @ 800x600x256 # vga=771 # VESA framebuffer console @ 640x480x64k # vga=785 # VESA framebuffer console @ 640x480x32k # vga=784 # VESA framebuffer console @ 640x480x256 # vga=769 EOF fi cat << EOF >> $T_PX/etc/lilo.conf # End LILO global section EOF # OK, now let's look for Windows partitions: DOSP="`PROBE -l | grep "DOS Win W95 FAT12 FAT16 HPFS" | grep -v "Ext\'d" | grep -v "Extend" | sort`" DOSP="`echo $DOSP | cut -f 1 -d ' '`" if [ ! "$DOSP" = "" ]; then TABLE="`echo $DOSP | cut -b1-8`" cat << EOF >> $T_PX/etc/lilo.conf # Windows bootable partition config begins other = $DOSP label = Windows table = $TABLE # Windows bootable partition config ends EOF echo "Windows - (Windows FAT/NTFS partition)" >> $T_PX/boot/boot_message.txt fi # Next, we search for Linux partitions: LNXP="`PROBE -l | grep "Linux$"`" LNXP="`echo $LNXP | cut -f 1 -d ' ' | sort`" if [ ! "$LNXP" = "" ]; then cat << EOF >> $T_PX/etc/lilo.conf # Linux bootable partition config begins image = $KERNEL root = $ROOT_DEVICE label = Zenwalk initrd = /boot/initrd.splash read-only # Linux bootable partition config ends EOF echo "Linux - (Linux partition)" >> $T_PX/boot/boot_message.txt fi echo >> $T_PX/boot/boot_message.txt # Done, now we must install lilo: installcolor; } checkp_text() { if [ ! -r $1 ]; then echo echo "I can\'t find a device named '$1'!" echo echo -n "Are you sure you want to use this device name [y]es, [n]o? " read use_device; if [ ! "$use_device" = "y" ]; then return 1; fi return 0; fi } checkp_dialog() { if [ ! -r $1 ]; then dialog --title "DEVICE FILE NOT FOUND" --yesno "I can't find a \ device named '$1'. Are you sure you want to use this device \ name?" 7 60 return $?; fi } installcolor() { dialog --infobox "\nInstalling the Linux Loader..." 5 40 if [ "$T_PX" = "/" ]; then lilo -P fix 1> /dev/null 2> /dev/null SUCCESS=$? else lilo -P fix -r $T_PX -m /boot/map -C /etc/lilo.conf 1> /dev/null 2> /dev/null SUCCESS=$? fi if [ ! "$SUCCESS" = "0" ]; then # edit file to try lba32 mode: cat $T_PX/etc/lilo.conf | while read line ; do echo $line if [ "$line" = "# Start LILO global section" ] ; then echo "lba32 # Allow booting past 1024th cylinder with a recent BIOS" fi done > $T_PX/etc/lilo.conf.lba32 mv $T_PX/etc/lilo.conf.lba32 $T_PX/etc/lilo.conf if [ "$T_PX" = "/" ]; then lilo -P fix 1> /dev/null 2> /dev/null SUCCESS=$? else lilo -P fix -r $T_PX -m /boot/map -C /etc/lilo.conf 1> /dev/null 2> /dev/null SUCCESS=$? fi fi if [ ! "$SUCCESS" = "0" ]; then # some LILO error occured dialog --title "LILO INSTALL ERROR # $SUCCESS" --msgbox \ "Sorry, but the attempt to install LILO has returned an error, so LILO \ has not been correctly installed. You'll have to use a bootdisk \ to start your \ machine instead. It should still be possible to get LILO working by \ editing the /etc/lilo.conf and reinstalling LILO manually. See the \ LILO man page and documentation in /usr/doc/lilo/ for more help." 11 60 fi } installtext() { echo "Installing the Linux Loader..." if [ "$T_PX" = "/" ]; then lilo -P fix SUCCESS=$? else lilo -P fix -r $T_PX -m /boot/map -C /etc/lilo.conf SUCCESS=$? fi if [ ! "$SUCCESS" = "0" ]; then # try lba32 mode: cat $T_PX/etc/lilo.conf | while read line ; do echo $line if [ "$line" = "# Start LILO global section" ] ; then echo "lba32 # Allow booting past 1024th cylinder with a recent BIOS" fi done > $T_PX/etc/lilo.conf.lba32 mv $T_PX/etc/lilo.conf.lba32 $T_PX/etc/lilo.conf if [ "$T_PX" = "/" ]; then lilo -P fix 1> /dev/null 2> /dev/null SUCCESS=$? else lilo -P fix -r $T_PX -m /boot/map -C /etc/lilo.conf 1> /dev/null 2> /dev/null SUCCESS=$? fi fi if [ ! "$SUCCESS" = "0" ]; then # some LILO error occured cat << EOF LILO INSTALL ERROR # $SUCCESS Sorry, but the attempt to install LILO has returned an error, so LILO has not been correctly installed. You'll have to use a bootdisk to start your machine instead. It should still be possible to get LILO working by editing the /etc/lilo.conf and reinstalling LILO manually. See the LILO man page and documentation in /usr/doc/lilo/ for more help. EOF fi } # 'probe()' borrowed from LILO QuickInst. probe() { [ ! -z "`dd if=$1 bs=1 count=1 2>/dev/null | tr '\0' x`" ] return } # Figure out if we're installing from the hard drive T_PX=$1 if [ "$T_PX" = "" ]; then T_PX=/ fi HDR="no" # this means the header section of /etc/lilo.conf has not yet # been configured LNX="no" # this means no Linux partition has been defined as bootable # through LILO. Both of these must change to "yes" before LILO will # install from this script. # Determine the root partition (such as /dev/hda2) ROOT_DEVICE=$2 if [ "$ROOT_DEVICE" = "" ]; then ROOT_DEVICE="`grep " / " /etc/fstab | cut -f 1 -d " "`" fi # Figure out where the kernel is: KERNEL=$3 if [ "$KERNEL" = "" ]; then if [ -r $T_PX/boot/vmlinuz ]; then KERNEL=/boot/vmlinuz else exit 99 # no kernel? guess you couldn't read. bye bye. fi fi # Let's see if we should automate things: dialog --title "INSTALL LILO" --menu "LILO is a \"multi operating systems\" \ boot loader. There's a simple installation which tries to automatically \ set up LILO to boot Linux. For more advanced users, the expert option \ offers more control over the installation process. Which option would you like?" \ 15 75 3 \ "simple" "Try to install LILO automatically" \ "expert" "Use expert lilo.conf setup menu" \ "skip" "Do not install LILO" 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then exit fi REPLY="`cat $TMP/reply`" rm -f $TMP/reply if [ "$REPLY" = "skip" ]; then exit elif [ "$REPLY" = "simple" ]; then # Do simple LILO setup simplelilo exit fi # drop through to last option: (use the expert menus) while [ 0 ]; do dialog --title "EXPERT LILO INSTALLATION" --menu \ "This menu directs the creation of the LILO config file, lilo.conf. \ To install, you make a new LILO configuration file by creating a new header \ and then adding one or more bootable partitions to the file. Once you've done \ this, you can select the install option. Alternately, if you already have an \ /etc/lilo.conf, you may reinstall using that. If you make a mistake, you can \ always start over by choosing 'Begin'. \ Which option would you like?" 20 75 7 \ "Begin" "Start LILO configuration with a new LILO header" \ "Linux" "Add a Linux partition to the LILO config" \ "Windows" "Add a Windows FAT or NTFS partition to the LILO config" \ "Install" "Install LILO" \ "Recycle" "Reinstall LILO using the existing lilo.conf" \ "Skip" "Skip LILO installation and exit this menu" \ "View" "View your current /etc/lilo.conf" 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then REPLY="Skip" else REPLY="`cat $TMP/reply`" fi rm -r $TMP/reply if [ "$REPLY" = "Begin" ]; then ask_append; if [ $? = 1 -o $? = 255 ]; then HDR="no" continue; else APPEND="`cat $TMP/reply`" APPEND="splash=silent ${APPEND}" if [ "$SWAPDEVICE" ]; then APPEND="resume=${SWAPDEVICE} ${APPEND}" fi fi use_framebuffer; dialog --title "SELECT LILO TARGET LOCATION" $DEFAULT --menu "LILO can be installed to the following places:\n\ \n\ 1. The Master Boot Record of your first hard drive.\n\ 2. The superblock of your root Linux partition.\n\ \n\ Please choose a location:" 15 75 2 \ "MBR" "Use the Master Boot Record (standard)" \ "Root" "Install to superblock (not for use with XFS)" \ 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then HDR="no" continue; else LNX="no" TG="`cat $TMP/reply`" fi rm -r $TMP/reply if [ "$TG" = "MBR" ]; then LILO_TARGET="/dev/sda" elif [ "$TG" = "Root" ]; then LILO_TARGET=`echo $ROOT_DEVICE` dialog --title "CONFIRM LOCATION TO INSTALL LILO" --inputbox \ "The auto-detected location to install the LILO boot loader is shown below. \ If you need to make any changes, you can make them below. Otherwise, hit \ ENTER to accept the target location shown." 11 75 $LILO_TARGET 2> $TMP/reply if [ $? = 0 ]; then LILO_TARGET="`cat $TMP/reply`" fi rm -f $TMP/reply else HDR="no" continue; fi dialog --title "CHOOSE LILO TIMEOUT" --menu "At boot time, how long would \ you like LILO to wait for you to select an operating system? If you \ let LILO time out, it will boot the first OS in the configuration file by \ default." 13 75 4 \ "None" "Don't wait at all - boot straight into the first OS" \ "5" "5 seconds" \ "30" "30 seconds" \ "Forever" "Present a prompt and wait until a choice is made" 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then HDR="no" continue; else TIMEOUT="`cat $TMP/reply`" fi rm -r $TMP/reply if [ "$TIMEOUT" = "None" ]; then PROMPT="#prompt" TIMEOUT="#timeout = 5" elif [ "$TIMEOUT" = "5" ]; then PROMPT="prompt" TIMEOUT="timeout = 50" elif [ "$TIMEOUT" = "30" ]; then PROMPT="prompt" TIMEOUT="timeout = 300" elif [ "$TIMEOUT" = "Forever" ]; then PROMPT="prompt" TIMEOUT="#timeout = 300" else HDR="no" continue; fi if [ "$APPEND" = "" ]; then cat << EOF > $TMP/lilo.conf # LILO configuration file # generated by 'liloconfig' # # Start LILO global section boot = $LILO_TARGET bitmap=/boot/splash.bmp bmp-table=234p,348p,1,4 bmp-colors=220,0,,255,220, bmp-timer=539p,396p,220,0, #compact # faster, but won't work on all systems. $PROMPT $TIMEOUT EOF if [ "$CONSOLETYPE" = "standard" ]; then cat << EOF >> $TMP/lilo.conf # Normal VGA console vga = normal # VESA framebuffer console @ 1024x768x64k # vga=791 # VESA framebuffer console @ 1024x768x32k # vga=790 # VESA framebuffer console @ 1024x768x256 # vga=773 # VESA framebuffer console @ 800x600x64k # vga=788 # VESA framebuffer console @ 800x600x32k # vga=787 # VESA framebuffer console @ 800x600x256 # vga=771 # VESA framebuffer console @ 640x480x64k # vga=785 # VESA framebuffer console @ 640x480x32k # vga=784 # VESA framebuffer console @ 640x480x256 # vga=769 EOF else cat << EOF >> $TMP/lilo.conf # VESA framebuffer console @ $CONSOLETYPE vga = $CONSOLENUM # Normal VGA console # vga = normal # VESA framebuffer console @ 1024x768x64k # vga=791 # VESA framebuffer console @ 1024x768x32k # vga=790 # VESA framebuffer console @ 1024x768x256 # vga=773 # VESA framebuffer console @ 800x600x64k # vga=788 # VESA framebuffer console @ 800x600x32k # vga=787 # VESA framebuffer console @ 800x600x256 # vga=771 # VESA framebuffer console @ 640x480x64k # vga=785 # VESA framebuffer console @ 640x480x32k # vga=784 # VESA framebuffer console @ 640x480x256 # vga=769 EOF fi cat << EOF >> $TMP/lilo.conf # ramdisk = 0 # paranoia setting # End LILO global section EOF HDR="yes" else cat << EOF > $TMP/lilo.conf # LILO configuration file # generated by 'liloconfig' # # Start LILO global section append="$APPEND" boot = $LILO_TARGET bitmap=/boot/splash.bmp bmp-table=234p,348p,1,4 bmp-colors=220,0,,255,220, bmp-timer=539p,396p,220,0, #compact # faster, but won't work on all systems. $PROMPT $TIMEOUT EOF if [ "$CONSOLETYPE" = "standard" ]; then cat << EOF >> $TMP/lilo.conf # Normal VGA console vga = normal # VESA framebuffer console @ 1024x768x64k # vga=791 # VESA framebuffer console @ 1024x768x32k # vga=790 # VESA framebuffer console @ 1024x768x256 # vga=773 # VESA framebuffer console @ 800x600x64k # vga=788 # VESA framebuffer console @ 800x600x32k # vga=787 # VESA framebuffer console @ 800x600x256 # vga=771 # VESA framebuffer console @ 640x480x64k # vga=785 # VESA framebuffer console @ 640x480x32k # vga=784 # VESA framebuffer console @ 640x480x256 # vga=769 EOF else cat << EOF >> $TMP/lilo.conf # VESA framebuffer console @ $CONSOLETYPE vga = $CONSOLENUM # Normal VGA console # vga = normal # VESA framebuffer console @ 1024x768x64k # vga=791 # VESA framebuffer console @ 1024x768x32k # vga=790 # VESA framebuffer console @ 1024x768x256 # vga=773 # VESA framebuffer console @ 800x600x64k # vga=788 # VESA framebuffer console @ 800x600x32k # vga=787 # VESA framebuffer console @ 800x600x256 # vga=771 # VESA framebuffer console @ 640x480x64k # vga=785 # VESA framebuffer console @ 640x480x32k # vga=784 # VESA framebuffer console @ 640x480x256 # vga=769 EOF fi cat << EOF >> $TMP/lilo.conf # ramdisk = 0 # paranoia setting # End LILO global section EOF HDR="yes" fi elif [ "$REPLY" = "Linux" ]; then if [ "$HDR" = "yes" ]; then echo "These are your Linux partitions:" > $TMP/tmpmsg echo >> $TMP/tmpmsg echo " Device Boot Start End Blocks Id System" >> $TMP/tmpmsg PROBE -l | grep "Linux$" | sort >> $TMP/tmpmsg echo >> $TMP/tmpmsg echo "Which one would you like LILO to boot?" >> $TMP/tmpmsg dialog --title "SELECT LINUX PARTITION" --no-collapse --inputbox \ "`cat $TMP/tmpmsg`" 20 75 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then rm $TMP/tmpmsg continue fi rm $TMP/tmpmsg LINUX_PART="`cat $TMP/reply`" checkp_dialog $LINUX_PART if [ ! $? = 0 ]; then continue; fi dialog --title "SELECT PARTITION NAME" --inputbox \ "Now you must give a short, unique name to this partition \ for the LILO prompt. THIS MUST BE A SINGLE WORD." 11 75 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then continue fi LABEL="`cat $TMP/reply`" cat << EOF >> $TMP/lilo.conf # Linux bootable partition config begins image = $KERNEL root = $LINUX_PART label = $LABEL initrd = /boot/initrd.splash read-only EOF else dialog --title "CAN'T ADD LINUX PARTITION" --msgbox "You can't add \ partitions unless you start over with a new LILO header." 6 75 continue fi LNX="yes" elif [ "$REPLY" = "Windows" ]; then if [ "$HDR" = "yes" ]; then echo "These are possibly Windows or DOS partitions. They will be treated" > $TMP/tmpmsg echo "as such if you install them using this menu." >> $TMP/tmpmsg echo >> $TMP/tmpmsg echo " Device Boot Start End Blocks Id System" >> $TMP/tmpmsg PROBE -l | grep "DOS Win W95 FAT12 FAT16 HPFS" | grep -v "Ext'd" | grep -v "Extend" | sort >> $TMP/tmpmsg echo >> $TMP/tmpmsg echo "Which one would you like LILO to boot?" >> $TMP/tmpmsg dialog --title "SELECT WINDOWS PARTITION" --no-collapse --inputbox \ "`cat $TMP/tmpmsg`" 20 75 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then rm $TMP/tmpmsg continue fi rm $TMP/tmpmsg DOSPART="`cat $TMP/reply`" checkp_dialog $DOSPART if [ ! $? = 0 ]; then continue; fi dialog --title "SELECT PARTITION NAME" --inputbox \ "Now you must give a short, unique name to this partition \ for the LILO prompt. THIS MUST BE A SINGLE WORD." 11 75 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then continue fi LABEL="`cat $TMP/reply`" unset USE_LOADER TABLE="`echo $DOSPART | cut -b1-8`" if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then USE_LOADER="no" fi if [ "`echo $TABLE | cut -b6-8`" = "sda" ]; then if probe /dev/hda; then USE_LOADER="yes" else USE_LOADER="no" fi fi if [ "$USE_LOADER" = "no" ]; then cat << EOF >> $TMP/lilo.conf # Windows bootable partition config begins other = $DOSPART label = $LABEL table = $TABLE # Windows bootable partition config ends EOF else cat << EOF >> $TMP/lilo.conf # Windows bootable partition config begins other = $DOSPART label = $LABEL # map-drive = 0x80 # to = 0x81 # map-drive = 0x81 # to = 0x80 table = $TABLE # Windows bootable partition config ends EOF fi else dialog --title "CAN'T ADD WINDOWS PARTITION" --msgbox "You can't add \ partitions unless you start over with a new LILO header." 6 75 continue fi LNX="yes" elif [ "$REPLY" = "Install" -o "$REPLY" = "Recycle" ]; then if [ "$REPLY" = "Recycle" -a -r $T_PX/etc/lilo.conf ]; then LNX="yes" fi if [ "$LNX" = "no" ]; then dialog --title "CAN'T INSTALL LILO" --msgbox "LILO could not be \ installed. If you have not created a LILO configuration file by defining \ a new header and adding at least one bootable partition to it, you must do \ so before installing LILO. If you were attempting to use an existing LILO \ configuration file, it could not be found. Try making a new one." 9 75 continue else if [ "$REPLY" = "Install" ]; then if [ -r $TMP/lilo.conf ]; then if [ -r $T_PX/etc/lilo.conf ]; then mv $T_PX/etc/lilo.conf $T_PX/etc/lilo.conf.bak fi cp $TMP/lilo.conf $T_PX/etc/lilo.conf chmod 644 $T_PX/etc/lilo.conf fi fi installcolor; fi rm -f $TMP/tmpmsg $TMP/reply break elif [ "$REPLY" = "Skip" ]; then rm -f $TMP/tmpmsg $TMP/reply break elif [ "$REPLY" = "View" ]; then if [ -r $TMP/lilo.conf ]; then dialog --title "YOUR NEW /etc/lilo.conf" --textbox "$TMP/lilo.conf" 22 75 else if [ -r /mnt/etc/lilo.conf ]; then dialog --title "YOUR OLD /etc/lilo.conf" --textbox "/mnt/etc/lilo.conf" 22 75 elif [ "$T_PX" = "/" -a -r /etc/lilo.conf ]; then dialog --title "YOUR OLD /etc/lilo.conf" --textbox "/etc/lilo.conf" 22 75 else dialog --title "NO CONFIG FILE FOUND" --msgbox "Sorry, but you don't \ have a LILO configuration file that can be viewed." 6 75 fi fi fi done