summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakboot
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/drakboot')
-rwxr-xr-xperl-install/standalone/drakboot131
1 files changed, 77 insertions, 54 deletions
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot
index c9e5386f5..3f3330d82 100755
--- a/perl-install/standalone/drakboot
+++ b/perl-install/standalone/drakboot
@@ -43,8 +43,8 @@ my $in = 'interactive'->vnew('su');
my $all_hds = fsedit::get_hds();
fs::get_raw_hds('', $all_hds);
-fs::get_info_from_fstab($all_hds, '');
-my $fstab = [ fsedit::get_all_fstab($all_hds) ];
+fs::get_info_from_fstab($all_hds);
+my $fstab = [ fs::get::fstab($all_hds) ];
my $bootloader = bootloader::read($fstab);
if (!$in->isa('interactive::gtk') || any { /^--boot$/ } @ARGV) {
@@ -78,16 +78,21 @@ unless ($::isEmbedded) {
######### menus end
}
-my $user_combo = Gtk2::ComboBox->new_text;
-$user_combo->set_popdown_strings(list_users());
-$user_combo->entry->set_text($auto_mode->{autologin}) if $auto_mode->{autologin};
-my $desktop_combo = Gtk2::ComboBox->new_text;
-$desktop_combo->set_popdown_strings(split(' ', `/usr/sbin/chksession -l`));
-$desktop_combo->entry->set_text($auto_mode->{desktop}) if $auto_mode->{desktop};
+my @users = sort(list_users());
+my @sessions = sort(split(' ', `/usr/sbin/chksession -l`));
+
+my $user = member($auto_mode->{autologin}, @users) ? $auto_mode->{autologin} : $users[0];
+if (!$user) {
+ # no user, bad but add root anyway:
+ $user = "root";
+ push @users, $user;
+}
+my $user_combo = Gtk2::ComboBox->new_with_strings(\@users, $user);
+my $desktop_combo = Gtk2::ComboBox->new_with_strings(\@sessions, if_(member($auto_mode->{desktop}, @sessions), $auto_mode->{desktop}));
my %themes = ('path' => '/usr/share/bootsplash/themes/',
'sysconfig' => '/etc/sysconfig/bootsplash',
- 'default' => 'Mandrake',
+ 'default' => 'Mandrakelinux',
'def_thmb' => '/usr/share/libDrakX/pixmaps/nosplash_thumb.png',
'lilo' => {'file' => '/lilo/message',
'thumb' => '/lilo/thumb.png' },
@@ -97,7 +102,6 @@ my %themes = ('path' => '/usr/share/bootsplash/themes/',
);
my $kernel_release = `uname -r`;
chomp $kernel_release;
-my $initrd = "/boot/initrd-$kernel_release.img" if -f "/boot/initrd-$kernel_release.img";
require Xconfig::resolution_and_depth;
my $cur_res;
@@ -122,27 +126,28 @@ if (-r $themes{sysconfig}) {
}
}
-my @boot_thms = if_(!$themes{default}, qw(default));
+my @boot_thms;
chdir($themes{path}); #- we must change directory for correct @boot_thms assignement
-foreach (all('.')) {
+foreach (sort(all('.'))) {
if (-d "$themes{path}$_" && m/^[^.]/) {
-f "$themes{path}$_$themes{boot}{path}bootsplash-$cur_res.jpg" and push @boot_thms, $_;
}
}
-my %combo = ('thms' => '', 'lilo' => '', 'boot' => '');
+push @boot_thms, $themes{default} unless member($themes{default}, @boot_thms);
+
+my %combo = ('thms' => '', 'lilo' => '');
foreach (keys(%combo)) {
$combo{$_} = gtkset_size_request(Gtk2::ComboBox->new_text, 10, -1);
}
-$combo{boot}->set_popdown_strings(@boot_thms);
-$combo{boot}->entry->set_text($themes{default});
+$combo{boot} = gtkset_size_request(Gtk2::ComboBox->new_with_strings(\@boot_thms, $themes{default}), 10, -1);;
my $boot_pic = gtkcreate_img($themes{def_thmb});
change_image($boot_pic, $themes{default});
my $_thm_button = Gtk2::Button->new(N("Install themes"));
my $_B_create = gtksignal_connect(Gtk2::Button->new(N("Create new theme")), clicked => sub { system('/usr/sbin/draksplash ') });
-
+
#- ******** action to take on changing combos values
$combo{boot}->entry->signal_connect(changed => sub { change_image($boot_pic, $combo{boot}->entry->get_text) });
@@ -153,16 +158,15 @@ gtkadd($window,
gtkpack_(Gtk2::VBox->new(0,0),
($splash_working ?
(1, gtkpack_(gtkset_border_width(Gtk2::VBox->new(0, 5), 5),
- 0, gtksignal_connect(gtkset_active(Gtk2::CheckButton->new(N("Use graphical boot")), $splash_mode),
+ 0, gtksignal_connect(gtkset_active(Gtk2::CheckButton->new(N("Use graphical boot")), $splash_mode),
clicked => sub {
$splash_mode = !$splash_mode;
- if ($boot_warn && $no_bootsplash && $splash_mode) {
- if ($in->ask_yesorno(N("Warning"),
+ if ($boot_warn && $no_bootsplash && $splash_mode) {
+ 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 ?") ])) {
- lilo_choice();
+ N("Do you want to configure it now?") ])) {
+ enable_framebuffer();
#- it would be nice to get available themes for new cur_res here
- $splash_mode = 1
};
$boot_warn = 0
}
@@ -193,19 +197,10 @@ gtkadd($window,
my @auto_buttons = gtkradio((N("No, I don't want autologin")) x 2,
N("Yes, I want autologin with this (user, desktop)")),
),
- gtkpack__(
- my $auto_box = Gtk2::HBox->new,
- gtkpack(
- Gtk2::VBox->new,
- Gtk2::Label->new(N("Default user")),
- Gtk2::Label->new(N("Default desktop")),
- ),
- gtkpack(
- Gtk2::VBox->new,
- $user_combo,
- $desktop_combo
- ),
- )
+ my $auto_box = create_packtable({ col_spacings => 5, row_spacings => 5, homogenous => 1 },
+ [ Gtk2::Label->new(N("Default user")), $user_combo ],
+ [ Gtk2::Label->new(N("Default desktop")), $desktop_combo ],
+ ),
)
)
),
@@ -214,7 +209,7 @@ gtkadd($window,
ok_clicked => sub {
Xconfig::various::runlevel($x_mode ? 5 : 3);
if ($splash_working) {
- $splash_mode and update_bootsplash($combo{boot}->entry->get_text, $splash_mode, $keep_logo);
+ update_bootsplash($combo{boot}->entry->get_text, $splash_mode, $keep_logo);
} else {
updateAutologin();
}
@@ -244,22 +239,13 @@ $in->exit(0);
sub lilo_choice() {
ask:
- eval {
- my $before = fs::fstab_to_string($all_hds);
- any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL});
- if ($before ne fs::fstab_to_string($all_hds)) {
- #- for /tmp using tmpfs when "clean /tmp" is chosen
- fs::write_fstab($all_hds);
- }
- };
- my $err = $@;
- if ($err && $err !~ /wizcancel/) {
- # BUG: note that the following message won't speak about the right bootloader if user is currently switching between
- # various bootloaders and if the error occured before boot sector get overwritten by bootloader installer
- $in->ask_warn(N("Error"),
- [ N("Installation of %s failed. The following error occured:", $bootloader->{method}), $err ]);
- goto ask;
+ my $before = fs::fstab_to_string($all_hds);
+ any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL}) or $in->exit;
+ if ($before ne fs::fstab_to_string($all_hds)) {
+ #- for /tmp using tmpfs when "clean /tmp" is chosen
+ fs::write_fstab($all_hds);
}
+ any::installBootloader($in, $bootloader, $all_hds) or goto ask;
}
@@ -288,14 +274,14 @@ sub update_bootsplash {
print "substInFile { s/^LOGO_CONSOLE=.*/LOGO_CONSOLE=$logo_console/ } $themes{sysconfig}\n";
print "system($switch_theme, $theme)\n";
} else {
- print "system($remove_theme, $theme)\n";
+ print "system($remove_theme)\n";
}
} else {
if ($splash_mode) {
substInFile { s/^LOGO_CONSOLE=.*/LOGO_CONSOLE=$logo_console/ } $themes{sysconfig};
system($switch_theme, $theme);
} else {
- system($remove_theme, $theme);
+ system($remove_theme);
}
}
}
@@ -303,9 +289,46 @@ sub update_bootsplash {
sub change_image {
my ($boot_pic, $val) = @_;
- my $img_file = $themes{path} . $val . $themes{boot}{path}."bootsplash-$cur_res.jpg";
+ my $img_file = $themes{path} . $val . $themes{boot}{path} . "bootsplash-$cur_res.jpg";
-f $img_file or return;
my $boot_pixbuf = gtkcreate_pixbuf($img_file);
$boot_pixbuf = $boot_pixbuf->scale_simple(300, 200, 'nearest');
$boot_pic->set_from_pixbuf($boot_pixbuf);
}
+sub enable_framebuffer() {
+ my $vga = Xconfig::resolution_and_depth::from_bios($bootloader->{default_vga});
+ my ($current_entry) = cat_('/proc/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;
+ }
+ bootloader::install($bootloader, $all_hds);
+ }
+ };
+ die if $@ && $@ !~ /^wizcancel/;
+ $::WizardWindow->destroy unless $::isEmbedded;
+ $vga;
+}