From 920f7d3d0ed4129054a1bf563029cb8e095ec165 Mon Sep 17 00:00:00 2001 From: Stew Benedict Date: Thu, 7 Mar 2002 00:40:00 +0000 Subject: drakboot functionality for PPC --- perl-install/any.pm | 6 +++--- perl-install/bootloader.pm | 39 ++++++++++++++++++++++++++------------- perl-install/bootlook.pm | 3 ++- perl-install/standalone/drakboot | 8 +++++--- 4 files changed, 36 insertions(+), 20 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index 591363911..bb7777aa0 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -162,7 +162,7 @@ sub setupBootloader { my $prev_clean_tmp = my $clean_tmp = grep { $_->{mntpoint} eq '/tmp' } @{$all_hds->{special} ||= []}; $b->{vga} ||= 'normal'; - if (arch !~ /ppc/) { + if (arch() !~ /ppc/) { $in->ask_from('', _("Bootloader main options"), [ { label => _("Bootloader to use"), val => \$bootloader, list => [ keys(%bootloaders) ], format => \&translate }, arch() =~ /sparc/ ? ( @@ -197,7 +197,7 @@ sub setupBootloader { $b->{boot} = $partition_table_mac::bootstrap_part; $in->ask_from('', _("Bootloader main options"), [ { label => _("Bootloader to use"), val => \$bootloader, list => [ keys(%bootloaders) ], format => \&translate }, - { label => _("Init Message"), val => \$b->{initmsg} }, + { label => _("Init Message"), val => \$b->{init-message} }, { label => _("Boot device"), val => \$b->{boot}, list => [ map { "/dev/$_" } (map { $_->{device} } (grep { isAppleBootstrap($_) } @$fstab))], not_edit => !$::expert }, { label => _("Open Firmware Delay"), val => \$b->{delay} }, { label => _("Kernel Boot Timeout"), val => \$b->{timeout} }, @@ -236,7 +236,7 @@ sub setupBootloader { # $b->{boot} !~ /$hds->[0]{device}/ && #- not the first disk $b->{boot} =~ /\d$/ && #- on a partition is_empty_hash_ref($b->{bios}) #- some bios mapping already there - ) { + ) && (arch() !~ /ppc/)){ my $hd = $in->ask_from_listf('', _("You decided to install the bootloader on a partition. This implies you already have a bootloader on the hard drive you boot (eg: System Commander). diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 60e048e7e..6975267be 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -85,6 +85,9 @@ sub read($$) { ($_, $v) = /^\s*(.*?)\s*(?:=\s*(.*?))?\s*$/; if (/^(image|other)$/) { + if (arch() =~ /ppc/) { + $v =~ s/hd:\d+,//g; + } push @{$b{entries}}, $e = { type => $_, kernel_or_dev => $v }; $global = 0; } elsif ($global) { @@ -92,6 +95,10 @@ sub read($$) { $b{bios}{$1} = $2; } elsif ($_ eq 'bios') { $b{bios}{$b{disk}} = $v; + } elsif ($_ eq 'init-message') { + $v =~ s/\\n//g; + $v =~ s/"//g; + $b{init-message} = $v; } else { $b{$_} = $v || 1; } @@ -99,14 +106,20 @@ sub read($$) { if ((/map-drive/ .. /to/) && /to/) { $e->{mapdrive}{$e->{'map-drive'}} = $v; } else { + if (arch() =~ /ppc/) { + $v =~ s/hd:\d+,//g; + $v =~ s/"//g; + } $e->{$_} = $v || 1; } } } - delete $b{timeout} unless $b{prompt}; - $_->{append} =~ s/^\s*"?(.*?)"?\s*$/$1/ foreach \%b, @{$b{entries}}; - $b{timeout} = $b{timeout} / 10 if $b{timeout}; - $b{message} = cat_("$prefix$b{message}") if $b{message}; + if (arch() != /ppc/) { + delete $b{timeout} unless $b{prompt}; + $_->{append} =~ s/^\s*"?(.*?)"?\s*$/$1/ foreach \%b, @{$b{entries}}; + $b{timeout} = $b{timeout} / 10 if $b{timeout}; + $b{message} = cat_("$prefix$b{message}") if $b{message}; + } \%b; } @@ -309,11 +322,11 @@ sub suggest { root => "/dev/$root", partition => $partition || 1, boot => $root eq $boot && "/boot", #- this helps for getting default partition for silo. - } : arch =~ /ppc/ ? + } : arch() =~ /ppc/ ? { defaultos => "linux", entries => [], - initmsg => "Welcome to Mandrake Linux!", + init-message => "Welcome to Mandrake Linux!", delay => 30, #- OpenFirmware delay timeout => 50, enableofboot => 1, @@ -394,11 +407,11 @@ wait %d seconds for default boot. } } elsif (arch() =~ /ppc/) { #- if we identified a MacOS partition earlier - add it - if (defined $partition_table_mac'macos_part) { + if (defined $partition_table_mac::macos_part) { add_entry($lilo->{entries}, { label => "macos", - kernel_or_dev => $partition_table_mac'macos_part + kernel_or_dev => $partition_table_mac::macos_part }); } } elsif (arch() !~ /ia64/) { @@ -525,7 +538,7 @@ sub install_yaboot($$$) { log::l("writing yaboot config to $f"); print F "#yaboot.conf - generated by DrakX"; - print F "init-message=\"\\n$lilo->{initmsg}\\n\"" if $lilo->{initmsg}; + print F "init-message=\"\\n$lilo->{init-message}\\n\"" if $lilo->{init-message}; if ($lilo->{boot}) { print F "boot=$lilo->{boot}"; @@ -540,14 +553,14 @@ sub install_yaboot($$$) { print F "magicboot=/usr/local/lib/yaboot/ofboot"; $lilo->{$_} and print F $_ foreach qw(enablecdboot enableofboot); $lilo->{$_} and print F "$_=$lilo->{$_}" foreach qw(defaultos default); - print F "nonvram"; + #- print F "nonvram"; my $boot = "/dev/" . $lilo->{useboot} if $lilo->{useboot}; foreach (@{$lilo->{entries}}) { if ($_->{type} eq "image") { my $of_dev = ''; - if ($boot !~ /$_->{root}/) { + if (($boot !~ /$_->{root}/) && $boot) { $of_dev = get_of_dev($prefix, $boot); print F "$_->{type}=$of_dev," . substr($_->{kernel_or_dev}, 5); } else { @@ -556,14 +569,14 @@ sub install_yaboot($$$) { } print F "\tlabel=", substr($_->{label}, 0, 15); #- lilo doesn't handle more than 15 char long labels print F "\troot=$_->{root}"; - if ($boot !~ /$_->{root}/) { + if (($boot !~ /$_->{root}/) && $boot) { print F "\tinitrd=$of_dev," . substr($_->{initrd}, 5) if $_->{initrd}; } else { print F "\tinitrd=$of_dev,$_->{initrd}" if $_->{initrd}; } #- xfs module on PPC requires larger initrd - say 6MB? print F "\tinitrd-size=6144" if $lilo->{xfsroot}; - print F "\tappend=\"$_->{append}\"" if $_->{append}; + print F "\tappend=\" $_->{append}\"" if $_->{append}; print F "\tread-write" if $_->{'read-write'}; print F "\tread-only" if !$_->{'read-write'}; } else { diff --git a/perl-install/bootlook.pm b/perl-install/bootlook.pm index ba4986f10..133ce3c9c 100644 --- a/perl-install/bootlook.pm +++ b/perl-install/bootlook.pm @@ -95,9 +95,10 @@ my $a_g_button = new Gtk::RadioButton _("Traditional Gtk+ Monitor"),$a_c_button my $a_button = new Gtk::CheckButton(_("Launch Aurora at boot time")); my $a_box = new Gtk::VBox(0, 0); my $x_box = new Gtk::VBox(0, 0); +my $disp_mode = arch() =~ /ppc/ ? "Yaboot mode" : "Lilo/grub mode"; gtkadd($window, gtkpack__ (my $global_vbox = new Gtk::VBox(0,0), - gtkadd (new Gtk::Frame (_("Lilo/grub mode")), + gtkadd (new Gtk::Frame (_("$disp_mode")), # gtkpack__(new Gtk::VBox(0,0), (gtkpack_(gtkset_border_width(new Gtk::HBox(0, 0),5), 1,_("You are currently using %s as Boot Manager. diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index 693307552..0d35c4498 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -37,9 +37,9 @@ goto ask; sub lilo_choice { - my $bootloader = bootloader::read('', '/etc/lilo.conf'); + my $bootloader = arch() =~ /ppc/ ? bootloader::read('', '/etc/yaboot.conf') : bootloader::read('', '/etc/lilo.conf'); local ($_) = `detectloader`; - $bootloader->{methods} = { lilo => 1, grub => !!/grub/i }; + $bootloader->{methods} = { lilo => 1, grub => !!/grub/i, yaboot => 1 }; my ($all_hds) = catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) } sub { 1 }; my $fstab = [ fsedit::get_all_fstab($all_hds) ]; @@ -52,9 +52,11 @@ sub lilo_choice any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL}) or return; eval { bootloader::install('', $bootloader, $fstab, $all_hds->{hds}) }; + my $loader = arch() =~ /ppc/ ? "Yaboot" : "LILO"; if ($@) { $in->ask_warn('', - [ _("Installation of LILO failed. The following error occured:"), + [ _("Installation of $loader failed. The following error +occured:"), grep { !/^Warning:/ } cat_("/tmp/.error") ]); unlink "/tmp/.error"; goto ask; -- cgit v1.2.1