diff options
author | Florent Villard <warly@mandriva.com> | 2003-11-18 09:28:35 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2003-11-18 09:28:35 +0000 |
commit | 750e1aa07bb6dcc39ea37275df876af938ca2422 (patch) | |
tree | d1896e36ee08dd72fb829279c344d46e5730dd05 /scripts/detect-resolution | |
parent | 78af07ac00cd6fc4ea969828b0f965d63f3077ba (diff) | |
download | bootsplash-750e1aa07bb6dcc39ea37275df876af938ca2422.tar bootsplash-750e1aa07bb6dcc39ea37275df876af938ca2422.tar.gz bootsplash-750e1aa07bb6dcc39ea37275df876af938ca2422.tar.bz2 bootsplash-750e1aa07bb6dcc39ea37275df876af938ca2422.tar.xz bootsplash-750e1aa07bb6dcc39ea37275df876af938ca2422.zip |
rely on initrd file to find correct bootloader entry and resolution in detect-resolution
correctly rewrite gray scaled jpeg
Diffstat (limited to 'scripts/detect-resolution')
-rwxr-xr-x | scripts/detect-resolution | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/scripts/detect-resolution b/scripts/detect-resolution index 4155613..9ea3519 100755 --- a/scripts/detect-resolution +++ b/scripts/detect-resolution @@ -6,14 +6,21 @@ # # Detect vga resolution we want. # +# add better detection thanks to Olivier Blin idea to use argument from +# make_boot_splash. #use strict; -my (%main, %entry); +my (%main, %entry, $vga, $initrd); -my $vga = detect_from_cmdline(cat_('/proc/cmdline')); -undef $vga if $vga =~ /x/; #lilo cmdline can't convert +if ($ARGV[0]) { + $initrd = $ARGV[0]; + $initrd =~ s,.*/,, +} else { + $vga = detect_from_cmdline(cat_('/proc/cmdline')); + undef $vga if $vga =~ /x/; #lilo cmdline can't convert +} -detect_from_loader() if not $vga; +detect_from_loader() if !$vga; if ($vga) { chomp $vga; $vga =~ s/vga=//; @@ -26,17 +33,21 @@ sub detect_from_loader { my $loader = `detectloader -q`;chomp $loader; if ($loader =~ m/lilo/i ) { parse_lilo_conf(); - $vga = $entry{$main{default}}{vga}; - $vga = $main{vga} if not $vga; } elsif ($loader =~ /grub/i ) { parse_grub_conf(); - $vga = detect_from_cmdline($entry{$main{default}}{options}); } + if ($initrd) { + $vga = $main{initrd}{$initrd} + } + $vga ||= $entry{$main{default}}{vga}; + $vga ||= $main{vga} + print "VGA ($vga) main $main{vga} initrd $initrd ($main{initrd}{$initrd})\n"; } sub parse_grub_conf { my ($title); my $cnt = 0; my $grub_conf = "/boot/grub/menu.lst"; + my $vga; return if not -f $grub_conf; open F, $grub_conf or die "Can't open $grub_conf\n"; @@ -44,20 +55,20 @@ sub parse_grub_conf { next if /^\s*#/; $main{default} = $1 if /^default (\d+)/; if (/^title\s+(.*)/) { + $vga=0; $title=$1; - $entry{$title}{title} = $title; $entry{$title}{cnt} = $cnt; $main{default} = $title if $entry{$title}{cnt} eq $main{default}; $cnt++; } - if (m/kernel\s+(\(.*\))([^\s]+)\s+(.*)/) { - $entry{$title}{partition} = $1; - $entry{$title}{kernel} = $2; - $entry{$title}{options} = $3; + if (m/kernel\s+\(.*\)[^\s]+/) { $vga = $1 if /vga=(.*)/; - $entry{$title}{vga} = $vga if ($label and $vga); + $entry{$title}{vga} = $vga if ($title and $vga); + } + if (m,initrd\s+\(.*\)(?:.*/)?([^\s]+),){ + $entry{$title}{initrd} = $1; + $main{initrd}{$1} = $entry{$title}{vga} } - $entry{$title}{initrd} = $1 if m/\s*initrd.*\)(.*)/; } close F; } @@ -72,9 +83,24 @@ sub parse_lilo_conf { $main{default} = $1 if m/^default=(.*)/; $main{vga} = $1 if m/^vga=(.*)/; $vga = $1 if /vga=(.*)/; - $label=$1 if /label=(.*)/; - $entry{$label}{vga} = $vga if ($label and $vga); - undef $vga if (/image=/ and $vga); + $label = $1 if /label=(.*)/; + $loc_initrd = $1 if m,initrd=(?:.*/)?(.*),; + $entry{$label}{vga} = $vga if ($label && $vga); + if (/image/) { + undef $vga,$label; + if ($loc_initrd && $label && $vga) { + $entry{$label}{initrd} = $loc_initrd; + if (!$main{initrd}{$loc_initrd} || $main{default} eq $label) { + $main{initrd}{$loc_initrd} = $vga + } + } + } + } + if ($loc_initrd && $label && $vga) { + $entry{$label}{initrd} = $loc_initrd; + if (!$main{initrd}{$loc_initrd} || $main{default} eq $label) { + $main{initrd}{$loc_initrd} = $vga + } } close F; } |