From 9e49ca02c5207d900ce75132b1311a082e604736 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 22 Jun 2016 02:05:25 +0200 Subject: better state machine needed for next commit --- perl-install/bootloader.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'perl-install/bootloader.pm') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 463f9edf5..2f379bd0b 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -316,7 +316,6 @@ sub read_grub2() { foreach (cat_utf8($f)) { next if /^#/; if (/menuentry\s+['"]([^']+)["']/) { - push @{$bootloader{entries}}, $entry if $entry; $entry = { label => $1 }; } elsif (/linux\s+(\S+)\s+(.*)?/ || /module\s+(\S+vmlinu\S+)\s+(.*)?/) { $entry->{type} = 'image'; @@ -328,10 +327,13 @@ sub read_grub2() { } } elsif (/initrd\s+(\S+)/ || /module\s+(\S+initrd\S+)\s+(.*)?/) { $entry->{initrd} = $1; + } elsif (/}/) { + if ($entry) { + push @{$bootloader{entries}}, $entry ; + undef $entry; + } } } - # last entry: - push @{$bootloader{entries}}, $entry if $entry; # get default entry: foreach (run_program::rooted_get_stdout($::prefix, qw(grub2-editenv list))) { -- cgit v1.2.1