3 # Install the GRUB boot loader
5 require './grub-lib.pl';
6 &error_setup($text{'install_err'});
9 # Find out which partition the menu file is on
10 @st = stat($config{'menu_file'});
11 &foreign_require("mount", "mount-lib.pl");
12 foreach $d (sort { length($a->[0]) <=> length($b->[0]) }
13 &mount::list_mounted()) {
15 $mount = $d->[0] if ($fst[0] == $st[0]);
18 $menu_file = $config{'menu_file'};
19 $menu_file =~ s/^\Q$mount\E//;
21 # Ask grub where the menu.lst file is
24 print TEMP "find $menu_file\n";
26 open(GRUB, "$config{'grub_path'} --batch <$temp |");
28 if (/find\s+(\S+)/ && $1 eq $menu_file) {
31 if (/^\s*(\(\S+\))/) {
41 &error($text{'install_efind'},"<pre>",$out,"</pre>");
44 # Setup on the chosen device
45 &ui_print_header(undef, $text{'install_title'}, "");
46 print &text('install_desc', $in{'dev'}, "<tt>root $root</tt>",
47 "<tt>setup $config{'install'}</tt>"),"<p>\n";
50 print TEMP "root $root\n";
51 print TEMP "setup $config{'install'}\n";
53 open(GRUB, "$config{'grub_path'} --batch <$temp |");
55 if (/\d+\s+sectors\s+are\s+embedded/i) {
61 print &html_escape($_);
65 if (!$embedded || $? || $error) {
66 print "$text{'install_failed'}<p>\n";
69 print "$text{'install_ok'}<p>\n";
72 &webmin_log("install");
73 &ui_print_footer("", $text{'index_return'});