home *** CD-ROM | disk | FTP | other *** search
- # Handles partitioning disks
-
- sub partition_disks {
- local ( $ret );
-
- if (! &rhs_yesno ( "Disk Partitions",
- <<EOM
- You must have one or more free partitions for your
- Linux filesystem. In addition, you may want to create
- a swap partition. If you have already created partitions
- for your new Linux system you can skip this step.
- >
- Do you need to partition your disks?
- >
- EOM
- , 70)) {
- return 1;
- }
-
- if (! &rhs_yesno ( "Disk Partitions",
- <<EOM
- >
- If you will be using OS/2 on your system in addition
- to Linux, you must use the OS/2 partitioning
- software. OS/2 will not recognize partitions created
- by the Linux partitioning software.
- >
- If you have not done this, choose the Reboot option,
- partition your drives with the OS/2 software, and
- restart the Red Hat installation.
- >
- Continue?
- >
- EOM
- , 70)) {
- return 0;
- }
-
- &rhs_msgbox ( "Disk Partitions",
- <<EOM
- >
- Each partition used for the Linux filesystem must be set as
- type 83. Each partition used for a Linux swap partition
- must be set as type 82.
- >
- EOM
- , 70);
-
- &_partition_disks;
- }
-
- sub _partition_disks {
- local ( $ret, $snarf, $disklist, $diskinfolist, $msg, $ent );
-
- $ret = &rhs_infobox ( "Disk Partitioning",
- <<EOM
- >
- Discovering what hard drives are attached to the system...
- >
- EOM
- , 70);
-
- @disklist = ();
- @diskinfolist = ();
- open(SAVEERR, ">&STDERR");
- open(STDERR, ">/dev/null");
- open(PROC, "fdisk -l |") || &newdie("Can't call fdisk!");
- while (<PROC>) {
- if (/^Disk (.*):(.*)$/) {
- $disklist[@disklist] = $1;
- $diskinfolist[@diskinfolist] = "$1:$2";
- }
- }
- close PROC;
- open(STDERR, ">&SAVEERR");
-
- $msg =
- <<EOM
- The following disks were found:
- >
- EOM
- ;
- foreach $ent (@diskinfolist) {
- $msg .= ">" . $ent . "\n";
- }
-
- while (1) {
- if (! &rhs_menu("Disk Partitioning", $msg,
- 70, 3,
- "fdisk", "Partition a disk with fdisk (command line)",
- "cfdisk", "Partition a disk with cfdisk (full screen)",
- "done", "Done with partitioning")) {
- last;
- }
- last if ($dialog_result eq "done");
- &partition_disk ("fdisk", @disklist) if ($dialog_result eq "fdisk");
- &partition_disk ("cfdisk", @disklist) if ($dialog_result eq "cfdisk");
- }
-
- &rhs_menu("Disk Partitioning",
- <<EOM
- >
- If fdisk (or cfdisk) complained about not being able
- to reload the partition tables, you should reboot now.
- >
- After rebooting skip the partitioning step and continue
- with the rest of the installation.
- >
- EOM
- , 70, 2,
- "Reboot", "Reboot now",
- "Continue", "Continue the install process");
-
- exit(0) if ($dialog_result eq "Reboot");
-
- return 1;
- }
-
- sub partition_disk {
- local ( $fdisk, @disklist ) = @_;
- local ( $ret );
-
- if (! &rhs_menul ( "Disk Partitioning",
- <<EOM
- >
- Which disk do you want to partition?
- >
- EOM
- , 50, scalar(@disklist), @disklist)) {
- return 1;
- }
-
- if ($fdisk eq "fdisk") {
- &invoke("fdisk $dialog_result");
- } else {
- &invoke("cfdisk $dialog_result");
- }
- print "\nHit enter to continue";
- <STDIN>;
- }
-
- ############
- 1;
-