diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-04-29 17:02:32 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-04-29 17:02:32 +0000 |
commit | 4018ce2ee5762d264775c9dd29fcdc0175af9add (patch) | |
tree | 48f1cab060dcc12643b0465beb1bd946c6f84c46 | |
parent | 059acf5946d08c4bdcc5b2b4dfb8a9658ff11af0 (diff) | |
download | drakx-4018ce2ee5762d264775c9dd29fcdc0175af9add.tar drakx-4018ce2ee5762d264775c9dd29fcdc0175af9add.tar.gz drakx-4018ce2ee5762d264775c9dd29fcdc0175af9add.tar.bz2 drakx-4018ce2ee5762d264775c9dd29fcdc0175af9add.tar.xz drakx-4018ce2ee5762d264775c9dd29fcdc0175af9add.zip |
initial bootsplash module
-rw-r--r-- | perl-install/bootsplash.pm | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/perl-install/bootsplash.pm b/perl-install/bootsplash.pm new file mode 100644 index 000000000..fe4af57ac --- /dev/null +++ b/perl-install/bootsplash.pm @@ -0,0 +1,64 @@ +package bootsplash; + +use common; + +my $themes_dir = "$::prefix/usr/share/bootsplash/themes/"; +my $sysconfig_file = '$::prefix/etc/sysconfig/bootsplash'; +my $default_theme = 'Mandrivalinux'; +our $default_thumbnail = '/usr/share/libDrakX/pixmaps/nosplash_thumb.png'; + +sub read_theme_config { + my ($res) = @_; + my %theme = ( + name => $default_theme, + enabled => 1, + keep_logo => 1 + ); + if (-r $sysconfig_file) { + local $_; + foreach (cat_($sysconfig_file)) { + /^SPLASH=no/ and $theme{enabled} = 0; + /^THEME=(.*)/ && -f get_theme_image($1, $res) and $theme{name} = $1; + /^LOGO_CONSOLE=(.*)/ and $theme{keep_logo} = $1 ne "no"; + } + } + \%theme; +} + +sub get_theme_image { + my ($theme, $res) = @_; + $themes_dir . $theme . '/images/bootsplash-' . $res . ".jpg"; +} + +sub list_themes { + my ($res) = @_; + grep { + !/^\./ && -d $themes_dir . $_ && -f get_theme_image($_, $res); + } sort(all($themes_dir)); +} + +sub switch_theme { + my ($theme) = @_; + if ($::testing) { + print "enabling bootsplash theme $theme\n"; + } else { + #- theme scripts will update SPLASH value in sysconfig file + system("$::prefix/usr/share/bootsplash/scripts/switch-themes", $theme); + } +} + +sub remove_theme() { + if ($::testing) { + print "disabling bootplash theme\n"; + } else { + system("$::prefix/usr/share/bootsplash/scripts/remove-theme"); + } +} + +sub set_logo_console { + my ($keep_logo) = @_; + my $logo_console = $keep_logo ? 'theme' : 'no'; + substInFile { s/^LOGO_CONSOLE=.*/LOGO_CONSOLE=$logo_console/ } $sysconfig_file; +} + +1; |