From 9208308d2fb117f89e242cff2ce90710041238d3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 11 Feb 2004 16:21:55 +0000 Subject: initial version --- tools/hd_grub.cgi | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 tools/hd_grub.cgi (limited to 'tools') diff --git a/tools/hd_grub.cgi b/tools/hd_grub.cgi new file mode 100755 index 000000000..fa292e872 --- /dev/null +++ b/tools/hd_grub.cgi @@ -0,0 +1,97 @@ +#!/usr/bin/perl + +use CGI ':all'; +use CGI::Carp; + +my $default_append = "ramdisk_size=128000 root=/dev/ram3"; +my $default_acpi = "acpi=ht"; +my $default_vga = "vga=788"; + +my $cgi_name = "/" . ($0 =~ m|([^/]+)$|)[0]; + +print + header(), + start_html(-TITLE => 'hd_grub configuration'); + +if (param()) { + print_menu_lst(); +} else { + print_form(); +} + +print end_html; + + +sub menu_lst { + my ($hd, $hd_linux, $partition_number, $directory) = @_; + + my $grub_partition_number = $partition_number - 1; + + <dd if=hd_grub.img of=/dev/fd0))), + li(qq(Copy the file "menu.lst" to the floppy, overwriting the existing one)), + ), + p(), + start_form(-name => 'form', -action => $cgi_name, -method => 'get'), + textarea(-default => menu_lst(param('hd'), param('hd_linux'), param('partition_number'), "/$directory"), + -rows => 15, -columns => 120, + ), + end_form(), +} + +sub print_form { + print + p(), + start_form(-name => 'form', -action => $cgi_name, -method => 'get'), + ul("Please choose the partition where Mandrake Linux is copied.", + li(popup_menu(-name => "hd", -default => 'hd0', + -values => [ 'hd0' .. 'hd3' ], + -labels => { hd0 => '1st BIOS hard drive (usually hda or sda)', + hd1 => '2nd BIOS hard drive', + hd2 => '3rd BIOS hard drive', + hd3 => '4th BIOS hard drive', + })), + li(popup_menu(-name => "hd_linux", -default => 'hda', + -values => [ 'hda' .. 'hdc', 'sda' .. 'sdc' ], + -labels => { + hda => '1st IDE hard drive (hda)', + hdb => '2nd IDE hard drive (hdb)', + hdc => '3rd IDE hard drive (hdc)', + sda => '1st SCSI hard drive (sda)', + sdb => '2nd SCSI hard drive (sdb)', + sdc => '3rd SCSI hard drive (sdc)', + })), + li(popup_menu(-name => "partition_number", -default => '0', + -values => [ 1 .. 15 ], + -labels => { 1 => '1st primary partition (hda1, sda1 or ...)', + 2 => '2nd primary partition', + 3 => '3rd primary partition', + 4 => '4th primary partition', + 5 => '5th partition (hda5, sda5 or ...) (first logical partition)', + map { $_ => $_ . 'th partition' } 6 .. 15 + })), + ), + p(), + ul("Please enter the directory containing the Mandrake Linux Distribution.", + li(textfield(-name => 'directory', -default => '/cooker/i586', size => 40)), + ), + p(submit(-name => 'Go')), + end_form(); +} -- cgit v1.2.1