From e1a1d3d2e14a141ff17ab5c550eb966092a19aa9 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 22 May 2015 03:10:54 -0400 Subject: drop remaining unused splash bits should have been done in commit 5a382f9b0c1fac53338afd7ddd2478a6e36f03e3 --- perl-install/bootsplash.pm | 85 ------------------------- perl-install/standalone/drakboot | 134 +-------------------------------------- 2 files changed, 1 insertion(+), 218 deletions(-) delete mode 100644 perl-install/bootsplash.pm (limited to 'perl-install') diff --git a/perl-install/bootsplash.pm b/perl-install/bootsplash.pm deleted file mode 100644 index 5539c0b98..000000000 --- a/perl-install/bootsplash.pm +++ /dev/null @@ -1,85 +0,0 @@ -package bootsplash; - -use common; -use Xconfig::resolution_and_depth; - - -my $themes_dir = "/usr/share/bootsplash/themes"; -my $themes_config_dir = "/etc/bootsplash/themes"; -my $sysconfig_file = "/etc/sysconfig/bootsplash"; -my $bootsplash_scripts = "/usr/share/bootsplash/scripts"; -my $default_theme = 'Mageialinux'; -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; - require fsedit; - my $all_hds = fsedit::get_hds(); - fs::get_info_from_fstab($all_hds); - my $bootloader = bootloader::read($all_hds); - my $x_res = Xconfig::resolution_and_depth::from_bios($bootloader->{default_options}{vga}); - $x_res ? - ($x_res->{X} . 'x' . $x_res->{Y}, 1) : - (first(@resolutions), 0); -} - -sub themes_read_sysconfig { - my ($res) = @_; - my %theme = ( - name => $default_theme, - enabled => 1, - ); - if (-r $::prefix . $sysconfig_file) { - local $_; - foreach (cat_($::prefix . $sysconfig_file)) { - /^SPLASH=no/ and $theme{enabled} = 0; - /^THEME=(.*)/ && -f theme_get_image_for_resolution($1, $res) and $theme{name} = $1; - } - } - \%theme; -} - -sub theme_get_image_for_resolution { - my ($theme, $res) = @_; - $::prefix . $themes_dir . '/' . $theme . '/images/bootsplash-' . $res . ".jpg"; -} - -sub theme_get_config_for_resolution { - my ($theme, $res) = @_; - $::prefix . $themes_config_dir . '/' . $theme . '/config/bootsplash-' . $res . ".cfg"; -} - -sub theme_exists_for_resolution { - my ($theme, $res) = @_; - -f theme_get_image_for_resolution($theme, $res) && -f theme_get_config_for_resolution($theme, $res); -} - -sub themes_list() { - grep { !/^\./ && -d $::prefix . $themes_dir . '/' . $_ } sort(all($::prefix . $themes_dir)); -} - -sub themes_list_for_resolution { - my ($res) = @_; - grep { theme_exists_for_resolution($_, $res) } themes_list(); -} - -sub switch { - my ($theme) = @_; - if ($::testing) { - print "enabling bootsplash theme $theme\n"; - } else { - #- theme scripts will update SPLASH value in sysconfig file - system($::prefix . $bootsplash_scripts . '/switch-themes', $theme); - } -} - -sub remove() { - if ($::testing) { - print "disabling bootsplash theme\n"; - } else { - system($::prefix . $bootsplash_scripts . '/remove-theme'); - } -} - -1; diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index f9c337d80..77e1922c6 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -44,7 +44,7 @@ my $cmdline = cat_('/proc/cmdline'); my $is_bootloader_mode = !$in->isa('interactive::gtk') || any { /^--boot$/ } @ARGV; -if ($is_bootloader_mode || any { /^--splash$/ } @ARGV) { +if ($is_bootloader_mode) { $all_hds = fsedit::get_hds(); fs::get_raw_hds('', $all_hds); fs::get_info_from_fstab($all_hds); @@ -115,68 +115,6 @@ sub run_boot_window { $in->exit(0); } -sub splash_choice() { - require bootsplash; - my ($cur_res, $bootsplash_available) = bootsplash::get_framebuffer_resolution(); - $bootsplash_available = 1 if $::testing; - - my $theme = bootsplash::themes_read_sysconfig($cur_res); - $bootsplash_available or $theme->{enabled} = 0; - - my $boot_pic = gtknew('Image', file => $bootsplash::default_thumbnail); - change_image($boot_pic, $theme->{name}, $cur_res); - - my $theme_combo = gtknew('ComboBox', text => $theme->{name}, list => [ bootsplash::themes_list_for_resolution($cur_res) ]); - $theme_combo->entry->signal_connect(changed => sub { - $theme->{name} = $theme_combo->entry->get_text; - change_image($boot_pic, $theme->{name}, $cur_res); - }); - - my $splash_box; - my $boot_warn = 1; - my %modes = ( - text => N("Text only"), - splash => N("Silent"), - ); - my $mode_combo = gtknew('ComboBox', text => $modes{$theme->{enabled} ? $cmdline =~ /\bsplash\b/ && $cmdline =~ /\bquiet\b/ ? 'splash' : 'text' : 'text'}, list => [ values %modes ]); - $mode_combo->entry->signal_connect(changed => sub { - $theme->{enabled} = $mode_combo->entry->get_text ne $modes{text}; - if ($boot_warn && !$bootsplash_available && $theme->{enabled}) { - if ($in->ask_yesorno(N("Warning"), - [ N("Your system bootloader is not in framebuffer mode. To activate graphical boot, select a graphic video mode from the bootloader configuration tool.") . "\n" . - N("Do you want to configure it now?") ])) { - enable_framebuffer(); - #- it would be nice to get available themes for new cur_res here - } - $boot_warn = 0; - } - $splash_box->set_sensitive($theme->{enabled}); - }); - - my $_thm_button = gtknew('Button', text => N("Install themes")); - - run_boot_window(N("Graphical boot theme selection"), - [ - 1, gtknew('VBox', spacing => 5, border_width => 5, children => [ - 0, gtknew('HBox', padding => 12, spacing => 5, children_tight => [ gtknew('Label', text => N("Graphical boot mode:")), $mode_combo ]), - 0, $splash_box = gtknew('HBox', sensitive => $theme->{enabled}, children_loose => [ - gtkadd(gtkcreate_frame(N("Theme")), - gtknew('VBox', border_width => 12, spacing => 12, children_tight => [ - $theme_combo, $boot_pic ])), ]), - ]), - ], - sub { - if ($theme->{enabled}) { - bootsplash::switch($theme->{name}); - } else { - bootsplash::remove(); - } - my $text = $mode_combo->entry->get_text; - my $mode = find { $modes{$_} eq $text } keys %modes; - set_splash_append($mode); - }); -} - sub autologin_choice() { my @users = sort(list_users()); my @sessions = sort(split(' ', `/usr/sbin/chksession -l`)); @@ -233,73 +171,3 @@ sub autologin_choice() { any::set_autologin($in->do_pkgs, $auto_mode); }); } - - -#------------------------------------------------------------- -# launch autologin functions -#------------------------------------------------------------- - -sub change_image { - my ($boot_pic, $theme, $res) = @_; - my $img_file = bootsplash::theme_get_image_for_resolution($theme, $res); - -f $img_file or return; - my $boot_pixbuf = gtknew('Pixbuf', file => $img_file); - $boot_pixbuf = $boot_pixbuf->scale_simple(300, 200, 'nearest'); - $boot_pic->set_from_pixbuf($boot_pixbuf); -} - -sub set_splash_append { - my ($mode) = @_; - if ($mode ne 'splash') { - bootloader::remove_append_simple($bootloader, 'splash'); - bootloader::remove_append_simple($bootloader, 'quiet'); - } else { - bootloader::set_append_simple($bootloader, 'splash'); - bootloader::set_append_simple($bootloader, 'quiet'); - } - modify_bootloader($bootloader, $all_hds); -} - -sub enable_framebuffer() { - my $vga = bootsplash::get_framebuffer_resolution(); - my ($current_entry) = $cmdline =~ /^BOOT_IMAGE=(\S+)/; - my %entries = ( - $current_entry => 1 - ); - local $::isWizard = 1; - local $::Wizard_no_previous = 1; - local $::Wizard_finished = 1; - $::Wizard_title = N("Boot Style Configuration"); - eval { - $in->ask_from(N("Video mode"), - N("Please choose a video mode, it will be applied to each of the boot entries selected below. -Be sure your video card supports the mode you choose."), - [ - { label => N("Video mode"), val => \$vga, - list => [ '', Xconfig::resolution_and_depth::bios_vga_modes() ], - format => \&Xconfig::resolution_and_depth::to_string - }, - map { - { text => $_->{label}, val => \$entries{$_->{label}}, type => 'bool' }; - } grep { $_->{label} !~ /failsafe|floppy|memtest/ } @{$bootloader->{entries}} - ]); - if ($vga) { - $vga = $vga->{bios} if ref($vga); - while (my ($label, $e) = each %entries) { - $e or next; - my $entry = find { $_->{label} eq $label } @{$bootloader->{entries}}; - $entry->{vga} = $vga; - } - modify_bootloader($bootloader, $all_hds); - } - }; - die if $@ && $@ !~ /^wizcancel/; - $::WizardWindow->destroy unless $::isEmbedded; - $vga; -} - -sub modify_bootloader { - my ($bootloader, $all_hds) = @_; - bootloader::action($bootloader, 'write', $all_hds); - bootloader::action($bootloader, 'when_config_changed'); -} -- cgit v1.2.1