Cosmetic tweaks to menu output

This commit is contained in:
Steve McIntyre 2013-04-23 17:33:03 +00:00
parent 9f329b5006
commit 15f47873b4
1 changed files with 15 additions and 3 deletions

View File

@ -32,7 +32,7 @@ my $incdepth = 0;
my @menu_number = (1,0,0,0,0); my @menu_number = (1,0,0,0,0);
my @menu_title = ('', '', '', '', ''); my @menu_title = ('', '', '', '', '');
my $menudepth = 0; my $menudepth = 0;
my $gap = ""; my $pre = "";
my %menu; my %menu;
sub parse_file { sub parse_file {
@ -77,7 +77,7 @@ sub print_kernel {
$initrd = $1; $initrd = $1;
$initrd =~ s?^.*initrd=??; $initrd =~ s?^.*initrd=??;
} }
print_indent "menuentry '$gap" . $k{"label"} . "' {\n"; print_indent "menuentry '$pre" . $k{"label"} . "' {\n";
print_indent " set background_color=black\n"; print_indent " set background_color=black\n";
print_indent " linux " . $k{"kernel"} . " " . $k{"append"} . "\n"; print_indent " linux " . $k{"kernel"} . " " . $k{"append"} . "\n";
print_indent " initrd $initrd\n"; print_indent " initrd $initrd\n";
@ -158,6 +158,11 @@ foreach my $line(@lines) {
if ($menudepth) { if ($menudepth) {
print_indent "}\n"; print_indent "}\n";
} }
if ($menudepth > 1) {
$pre = "... ";
} else {
$pre = "";
}
} elsif ($line =~ /^\s*menu title (.*$)/) { } elsif ($line =~ /^\s*menu title (.*$)/) {
if ($in_kernel) { if ($in_kernel) {
print_kernel(\%kernel); print_kernel(\%kernel);
@ -166,10 +171,17 @@ foreach my $line(@lines) {
} }
$menu{"title"} = $1; $menu{"title"} = $1;
if ($new_menu) { if ($new_menu) {
print_indent "submenu '$gap" . $menu{"title"} . "\' {\n"; print_indent "submenu '$pre" . $menu{"title"} . " ...' {\n";
$menu_title[$menudepth] = $menu{"title"}; $menu_title[$menudepth] = $menu{"title"};
$menudepth++; $menudepth++;
if ($menudepth > 1) {
$pre = "... ";
} else {
$pre = "";
}
debug(); debug();
print_indent "set menu_color_normal=cyan/blue\n";
print_indent "set menu_color_highlight=white/blue\n";
print_indent "set theme=/boot/grub/theme/" . $menu{"number"} . "\n"; print_indent "set theme=/boot/grub/theme/" . $menu{"number"} . "\n";
create_theme_file($menu{"number"}); create_theme_file($menu{"number"});
$new_menu = 0; $new_menu = 0;