home *** CD-ROM | disk | FTP | other *** search
- # set up lilo -*-perl-*-
-
- $liloconf = "";
- $append_text = "";
-
- sub install_lilo {
-
- local ( $boot );
-
- if (! -e "$fsmount/vmlinuz") {
- &rhs_msgbox("Error",
- <<EOM
- >
- No kernel is installed!
- >
- LILO can not be configured without a kernel.
- >
- EOM
- , 60);
- return 0;
- }
-
- if (! &rhs_yesno("LILO",
- <<EOM
- >
- LILO is a Boot Manager which allows you to start
- Red Hat Linux directly from your hard
- drive. It will also let you boot other operating systems
- on other partitions.
- >
- If you do not install LILO, you will have to use your boot
- diskette or some other boot loader to start the Network
- Desktop.
- >
- Do you want to install LILO?
- >
- EOM
- , 60)) {
- return 1;
- }
-
- $_ = $root_dev;
- if (/\/dev\/hd.*/) {
- $p1 = "/dev/hda";
- $p2 = "/dev/sda";
- $t1 = "IDE";
- $t2 = "SCSI";
- } else {
- $p2 = "/dev/hda";
- $p1 = "/dev/sda";
- $t2 = "IDE";
- $t1 = "SCSI";
- }
-
- if (! &rhs_menu("LILO Installation",
- <<EOM
- >
- Where do you want to install LILO?
- >
- EOM
- , 70, 5,
- $p1, "On the MBR of $p1. (The first $t1 hard disk)",
- $p2, "On the MBR of $p2. (The first $t2 hard disk)",
- "/dev/fd0", "On a floppy in /dev/fd0. (Drive A:)",
- $root_dev, "On the superblock of your root Linux partition",
- "other", "On some other partition")) {
- return 1;
- }
- $boot = $dialog_result;
-
- if ($boot eq "other") {
- if (! &rhs_inputbox("LILO Installation",
- <<EOM
- >
- Where do you want to put LILO?
- >
- EOM
- , 50, "/dev/")) {
- return 1;
- }
- $boot = $dialog_result;
- }
-
- $liloconf =
- <<EOM
- boot=$boot
- map=/boot/map
- install=/boot/boot.b
- prompt
- timeout=50
- image=/vmlinuz
- label=linux
- root=$root_dev
- read-only
- EOM
- ;
-
- &do_append_stuff;
-
- &add_os_to_liloconf;
-
- open(FD, ">$fsmount/etc/lilo.conf");
- print FD $liloconf;
- close(FD);
-
- if (! $express_install) {
- &rhs_textbox("Review /etc/lilo.conf", "$fsmount/etc/lilo.conf", 78, 22);
-
- if (! &rhs_yesno("Notice",
- <<EOM
- >
- If you think that the lilo.conf file you just reviewed
- is incorrect, cancel the LILO configuration, start
- a shell, fix $fsmount/etc/lilo.conf, and run
- lilo -r $fsmount.
- >
- Continue with LILO configuration?
- >
- EOM
- , 60)) {
- return 0;
- }
- }
-
- &rhs_infobox("LILO",
- <<EOM
- >
- Installing LILO...
- >
- EOM
- , 50);
-
- if (&invoke("lilo -r $fsmount")) {
- &rhs_msgbox("Error",
- <<EOM
- >
- Something went wrong running LILO. Try configuring LILO again.
- >
- EOM
- , 60);
- return 0;
- } else {
- return 1;
- }
- }
-
- sub do_append_stuff {
-
- if (&rhs_yesno("LILO Configuration",
- <<EOM
- >
- If you needed to specify hardware parameters on the
- LILO command line to boot the install disk, you will
- need to add some information to your lilo configuration.
- >
- Do you need to specify hardware parameters?
- >
- EOM
- , 60)) {
- if (&rhs_inputbox("LILO Configuration",
- <<EOM
- >
- Enter the parameter below (ex: hd=64,32,202).
- This will be added as an append line to your
- LILO configuration.
- >
- EOM
- , 70, $append_text)) {
- $append_text = $dialog_result;
- }
- }
- $liloconf .=
- <<EOM
- append = "$append_text"
- EOM
- ;
- }
-
- sub add_os_to_liloconf {
- local ( %tmpparlist, $dev, $label, $table );
- local ( $p, $r );
-
- while (&rhs_yesno("LILO Configuration",
- <<EOM
- >
- Do you want to indicate another operating system as an option for LILO to start?
- >
- EOM
- , 60)) {
- if (! &rhs_menu("LILO Configuration",
- <<EOM
- >
- Which operating system do you wish to add?
- >
- EOM
- , 60, 4,
- "Linux", "Another Linux partition",
- "DOS", "A DOS partition",
- "OS/2", "An OS/2 partition",
- "Other", "An operating system not listed here")) {
- next;
- }
-
- if ($dialog_result eq "Linux") {
- %tmpparlist = ();
- open(SAVEERR, ">&STDERR");
- open(STDERR, ">/dev/null");
- open(PROC, "fdisk -l |");
- while (<PROC>) {
- if (/^(.{10}).{5}(.{31}).*Linux native$/) {
- $p = $1; $r = $2;
- $p =~ s/\s$//;
- $tmpparlist{$p} = "$r";
- }
- }
- close PROC;
- open(STDERR, ">&SAVEERR");
- if (! &rhs_menua("LILO Configuration",
- <<EOM
- >
- Which Linux partition?
- >
- > Device Begin Start End Blocks
- EOM
- , 54, %tmpparlist)) {
- next;
- }
- $dev = $dialog_result;
- $label = &lilo_getlabel;
- next if ($label eq "");
- $liloconf .=
- <<EOM
- image=/vmlinuz
- label=$label
- root=$dev
- read-only
- EOM
- ;
- &do_append_stuff;
- } elsif ($dialog_result eq "DOS") {
- %tmpparlist = ();
- open(SAVEERR, ">&STDERR");
- open(STDERR, ">/dev/null");
- open(PROC, "fdisk -l |");
- while (<PROC>) {
- if (/^(.{10}).{5}(.{31}).*DOS.*$/) {
- $p = $1; $r = $2;
- $p =~ s/\s$//;
- $tmpparlist{$p} = "$r";
- }
- }
- close PROC;
- open(STDERR, ">&SAVEERR");
- if (! &rhs_menua("LILO Configuration",
- <<EOM
- >
- Which DOS partition?
- >
- > Device Begin Start End Blocks
- EOM
- , 54, %tmpparlist)) {
- next;
- }
- $dev = $dialog_result;
- $label = &lilo_getlabel;
- next if ($label eq "");
- $table = substr($dev, 0, 8);
- $liloconf .=
- <<EOM
- other=$dev
- label=$label
- table=$table
- EOM
- ;
- } elsif ($dialog_result eq "OS/2") {
- %tmpparlist = ();
- open(SAVEERR, ">&STDERR");
- open(STDERR, ">/dev/null");
- open(PROC, "fdisk -l |");
- while (<PROC>) {
- if (/^(.{10}).{5}(.{31}).*DOS.*$/) {
- $p = $1; $r = $2;
- $p =~ s/\s$//;
- $tmpparlist{$p} = "$r";
- }
- if (/^(.{10}).{5}(.{31}).*HPFS.*$/) {
- $p = $1; $r = $2;
- $p =~ s/\s$//;
- $tmpparlist{$p} = "$r";
- }
- }
- close PROC;
- open(STDERR, ">&SAVEERR");
- if (! &rhs_menua("LILO Configuration",
- <<EOM
- >
- Which OS/2 partition?
- >
- > Device Begin Start End Blocks
- EOM
- , 54, %tmpparlist)) {
- next;
- }
- $dev = $dialog_result;
- $label = &lilo_getlabel;
- next if ($label eq "");
- $table = substr($dev, 0, 8);
- $liloconf .=
- <<EOM
- other=$dev
- label=$label
- table=$table
- EOM
- ;
- if ($table eq "/dev/hda") {
- $liloconf .=
- <<EOM
- loader = /boot/os2_d.b
- EOM
- ;
- }
- } elsif ($dialog_result eq "Other") {
- %tmpparlist = ();
- open(SAVEERR, ">&STDERR");
- open(STDERR, ">/dev/null");
- open(PROC, "fdisk -l |");
- while (<PROC>) {
- if (/^(\/dev\/.{5}).{5}(.{31}).*$/) {
- $p = $1; $r = $2;
- $p =~ s/\s$//;
- $tmpparlist{$p} = "$p";
- }
- }
- close PROC;
- open(STDERR, ">&SAVEERR");
- if (! &rhs_menua("LILO Configuration",
- <<EOM
- >
- Which is your main Linux parition?
- >
- > Device Begin Start End Blocks
- EOM
- , 54, %tmpparlist)) {
- next;
- }
- $dev = $dialog_result;
- $label = &lilo_getlabel;
- next if ($label eq "");
- $table = substr($dev, 0, 8);
- $liloconf .=
- <<EOM
- other=$dev
- label=$label
- table=$table
- loader=/boot/any_d.b
- EOM
- ;
- }
- }
-
- return 1;
- }
-
- sub lilo_getlabel {
-
- if (! &rhs_inputbox("LILO Configuration",
- <<EOM
- >
- Enter a single word as a name for this system. A
- LILO: prompt appears when you start your computer;
- this is the name that you will type to start this
- operating system.
- >
- EOM
- , 60, "")) {
- return "";
- }
-
- return $dialog_result;
- }
-
-
- ##########################
- 1;
-