diff options
Diffstat (limited to 'grub-gfxmenu')
-rwxr-xr-x | grub-gfxmenu | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/grub-gfxmenu b/grub-gfxmenu deleted file mode 100755 index 9da113a..0000000 --- a/grub-gfxmenu +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl - -use Getopt::Long; - -my $gfxmenu = '/boot/gfxmenu'; - -my %options = ( - "lang=s" => \ (my $lang), - "update-theme" => \ (my $update_theme), - "update-gfxmenu" => \ (my $update_gfxmenu), - "quiet" => \ (my $quiet), - ); - -GetOptions(%options) && @ARGV == 0 && ($lang || $update_theme || $update_gfxmenu) or usage(); - -if ($update_gfxmenu) { - $update_theme = 1; - $lang ||= eval { get_lang() }; - sys('cp', '/usr/share/gfxboot/themes/Mandriva/boot/message', $gfxmenu); -} - -if (!-e $gfxmenu) { - warn "$gfxmenu doesn't exist\n" if !$quiet; - exit; -} - -if ($lang) { - set_lang($lang); -} -if ($update_theme) { - set_theme(); -} - -sub usage { - die "grub-gfxmenu [--quiet] [--lang <lang>] [--update-theme] [--update-gfxmenu]\n"; -} - -sub set_theme() { - my $background_dir = '/usr/share/gfxboot/themes/current'; - - #checking - -f "$background_dir/back.jpg" or return; - remove_file('back.jpg'); - sys("echo back.jpg | (cd $background_dir ; cpio -o --quiet -O $gfxmenu --append)"); -} - -sub remove_file { - my ($file) = @_; - sys("cpio-filter --in-place --exclude $file $gfxmenu"); -} - -sub get_lang() { - require Archive::Cpio; - - my $cpio = Archive::Cpio->new; - $cpio->read($gfxmenu); - my $e = $cpio->get_file('lang') or return; - my $lang = $e->{data}; - chomp $lang; - $lang; -} - -sub set_lang { - my ($lang) = @_; - - require Archive::Cpio; - - my $cpio = Archive::Cpio->new; - $cpio->read($gfxmenu); - if (my $e = $cpio->get_file('lang')) { - $e->{data} = "$lang\n"; - } else { - $cpio->add_data('lang', "$lang\n"); - } - $cpio->write($gfxmenu); -} - -sub system_verbose { print join(' ', @_), "\n"; system(@_) } -sub sys { system(@_); $? and die } |