diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-05-09 11:41:15 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-05-09 11:41:15 +0000 |
commit | 7288042965c351d1902be4cd86aec1e5e59312b4 (patch) | |
tree | 919bd353f5360974f40848e410b49e47fdefe937 | |
parent | 265fcfdb14d846746243f18ba01d899c8ef4a9fa (diff) | |
download | drakx-7288042965c351d1902be4cd86aec1e5e59312b4.tar drakx-7288042965c351d1902be4cd86aec1e5e59312b4.tar.gz drakx-7288042965c351d1902be4cd86aec1e5e59312b4.tar.bz2 drakx-7288042965c351d1902be4cd86aec1e5e59312b4.tar.xz drakx-7288042965c351d1902be4cd86aec1e5e59312b4.zip |
add get_framebuffer_resolution and create_path
-rw-r--r-- | perl-install/bootsplash.pm | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/perl-install/bootsplash.pm b/perl-install/bootsplash.pm index 3ee4772f7..2184b07b2 100644 --- a/perl-install/bootsplash.pm +++ b/perl-install/bootsplash.pm @@ -1,6 +1,7 @@ package bootsplash; use common; +use Xconfig::resolution_and_depth; my $themes_dir = "$::prefix/usr/share/bootsplash/themes"; my $themes_config_dir = "$::prefix/etc/bootsplash/themes"; @@ -8,6 +9,16 @@ my $sysconfig_file = "$::prefix/etc/sysconfig/bootsplash"; my $bootsplash_scripts = "$::prefix/usr/share/bootsplash/scripts"; my $default_theme = 'Mandrivalinux'; our $default_thumbnail = '/usr/share/libDrakX/pixmaps/nosplash_thumb.png'; +our @resolutions = uniq(map { "$_->{X}x$_->{Y}" } Xconfig::resolution_and_depth::bios_vga_modes()); + +sub get_framebuffer_resolution { + require bootloader; + my $bootloader = bootloader::read(); + my $x_res = Xconfig::resolution_and_depth::from_bios($bootloader->{default_vga}); + $x_res ? + ($x_res->{X} . 'x' . $x_res->{Y}, 1) : + (first(@resolutions), 0); +} sub themes_read_sysconfig { my ($res) = @_; @@ -75,9 +86,17 @@ sub set_logo_console { substInFile { s/^LOGO_CONSOLE=.*/LOGO_CONSOLE=$logo_console/ } $sysconfig_file; } +sub create_path { + my ($file) = @_; + require File::Basename; + my $dir = File::Basename::dirname($file); + -d $dir or mkdir_p($dir); +} + sub theme_set_image_for_resolution { my ($name, $res, $source_image) = @_; my $dest_image = theme_get_image_for_resolution($name, $res); + create_path($dest_image); system('convert', '-scale', $res, $source_image, $dest_image); system($bootsplash_scripts . '/rewritejpeg', $dest_image); } @@ -91,10 +110,7 @@ sub theme_write_config_for_resolution { my ($name, $res, $conf) = @_; my $config = theme_get_config_for_resolution($name, $res); - require File::Basename; - my $dir = File::Basename::dirname($config); - -d $dir or mkdir_p($dir); - + create_path($config); output($config, qq(# This is the configuration file for the $res bootsplash picture # this file is necessary to specify the coordinates of the text box on the |