From cf4419ef4e654952f09bbb8bf31b4247ece0f9ec Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 28 Apr 2009 13:09:04 +0000 Subject: Remove unneeded locales from gfxboot data file The gfxboot data file (bootlogo) installed by mandriva-gfxboot-theme package contains translations for all known languages. However, if this file is too big, this causes boot problems on some systems (bug #48688). On Ones, since we know the languages that will be included on the live cd, we can remove all the locales we don't need from the bootlogo file. --- draklive | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/draklive b/draklive index 0d78c96..4170ccb 100755 --- a/draklive +++ b/draklive @@ -480,6 +480,38 @@ sub create_bootloader { } } +sub remove_unneeded_bootlogo_locales { + use File::Temp; + use Cwd; + + my ($bootlogo, @locales) = @_; + + $bootlogo = Cwd::realpath ($bootlogo); + -f $bootlogo or return; + + my $cwd = Cwd::getcwd(); + my $tempdir = File::Temp::tempdir ("mdvgfxbootXXXX", CLEANUP => 1); + chdir $tempdir; + !system ("cpio -id < $bootlogo") or return; + + # Make sure we include the en locale + push @locales, 'en'; + my @kept_locales; + foreach my $file (glob "*.tr") { + if (!grep { $file =~ /^$_\.tr$/ } @locales) { + unlink $file; + } else { + my ($locale_name) = ($file =~ /(.*)\.tr$/); + push @kept_locales, $locale_name; + } + } + system("echo init 16x16.fnt *.tr |sed \"s/ /\\n/g\" |cpio -o >$bootlogo"); + chdir $cwd; + + print "gfxboot locales: " . join(" ", @kept_locales) . "\n"; + return @kept_locales; +} + sub create_media_bootloader { my ($live) = @_; cp_f($live->get_system_root . '/boot/vmlinuz-' . $live->find_kernel, $live->get_builddir . $live->{prefix}{build}{boot} . '/vmlinuz'); @@ -499,6 +531,8 @@ sub create_media_bootloader { } my $bootlogo = $syslinux_dir . '/bootlogo'; warn "unable to find gfxboot splash ($bootlogo)\n" if ! -f $bootlogo; + my @locales = remove_unneeded_bootlogo_locales($bootlogo, get_langs($live)); + output_p($syslinux_dir . '/langs', join("\n", @locales) . "\n"); output_p($syslinux_dir . '/gfxboot.cfg', join("\n", "livecd=1", "mainmenu.pos=210,235", "mainmenu.bar.minwidth=400", "panel.f-key.fg=0x33358c")); -- cgit v1.2.1