summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-07-19 13:15:15 +0000
committerFrancois Pons <fpons@mandriva.com>2000-07-19 13:15:15 +0000
commit59ef5c4f7b0fa1f4fe427f7cc90d90199dfde524 (patch)
treed756fdd13f1af4e6c6a82274e760904ac92a38b3
parentc6697db38742386d84761fb77011ca2f137d554b (diff)
downloaddrakx-59ef5c4f7b0fa1f4fe427f7cc90d90199dfde524.tar
drakx-59ef5c4f7b0fa1f4fe427f7cc90d90199dfde524.tar.gz
drakx-59ef5c4f7b0fa1f4fe427f7cc90d90199dfde524.tar.bz2
drakx-59ef5c4f7b0fa1f4fe427f7cc90d90199dfde524.tar.xz
drakx-59ef5c4f7b0fa1f4fe427f7cc90d90199dfde524.zip
*** empty log message ***
-rw-r--r--perl-install/ChangeLog10
-rw-r--r--perl-install/any.pm4
-rw-r--r--perl-install/bootloader.pm35
-rw-r--r--perl-install/install_steps.pm28
4 files changed, 52 insertions, 25 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index 2144330f6..6ca69d482 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -1,3 +1,13 @@
+2000-07-19 François Pons <fpons@mandrakesoft.com>
+
+ * any.pm: added default root to existing root device when adding
+ an entry in bootloader.
+ * bootloader.pm: avoid duplicating entry (floppy and old-floppy)
+ when they are identical.
+ manage hackkernel by suggest an entry by default if installed.
+ * install_steps.pm: reworked symlink closure for bootloader
+ to keep previous configuration.
+
2000-07-11 François Pons <fpons@mandrakesoft.com>
* bootloader.pm: merged lilo.pm and silo.pm inside bootloader.pm,
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 23313c5f6..52b33a9ad 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -137,7 +137,9 @@ You can add some more or change the existing ones."),
if ($in->ask_from_list_('', _("Which type of entry do you want to add?"),
[ __("Linux"), arch() =~ /sparc/ ? __("Other OS (SunOS...)") : __("Other OS (windows...)") ]
) eq "Linux") {
- $e = { type => 'image' };
+ $e = { type => 'image',
+ root => '/dev/' . fsedit::get_root($fstab)->{device}, #- assume a good default.
+ };
$prefix = "linux";
} else {
$e = { type => 'other' };
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 11f9d2ae3..20633970e 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -113,6 +113,15 @@ sub suggest_onmbr($) {
!$type || member($type, qw(dos dummy lilo grub empty)), !$type;
}
+sub compare_entries($$) {
+ my ($a, $b) = @_;
+ my %entries;
+
+ @entries{keys %$a, keys %$b} = ();
+ $a->{$_} eq $b->{$_} and delete $entries{$_} foreach keys %entries;
+ scalar keys %entries;
+}
+
sub add_entry($$) {
my ($entries, $v) = @_;
my (%usedold, $freeold);
@@ -120,13 +129,21 @@ sub add_entry($$) {
do { $usedold{$1 || 0} = 1 if $_->{label} =~ /^old ([^_]*)_/x } foreach @$entries;
foreach (0..scalar keys %usedold) { exists $usedold{$_} or $freeold = $_ || '', last }
- do { $_->{label} = "old${freeold}_$_->{label}" if $_->{label} eq $v->{label} } foreach @$entries;
- push @$entries, $v;
+ foreach (@$entries) {
+ if ($_->{label} eq $v->{label}) {
+ if (compare_entries($_, $v)) {
+ $_->{label} = "old${freeold}_$_->{label}";
+ } else {
+ $v = undef; #- avoid inserting it twice as another entry already exists !
+ }
+ }
+ }
+ $v and push @$entries, $v;
}
sub add_kernel($$$$$) {
my ($prefix, $lilo, $kernelVersion, $specific, $v) = @_;
- my $ext = $specific && "-$specific";
+ my $ext = $specific && "-$specific"; $specific eq 'hack' and $specific = '';
my ($vmlinuz, $image, $initrdImage) = ("vmlinuz-$kernelVersion$specific", "/boot/vmlinuz$ext", "/boot/initrd$ext.img");
-e "$prefix/boot/$vmlinuz" or log::l("unable to find kernel image $prefix/boot/$vmlinuz"), return;
{
@@ -180,6 +197,7 @@ sub suggest($$$$$) {
my $root_part = fsedit::get_root($fstab);
my $root = isLoopback($root_part) ? "loop7" : $root_part->{device};
my $boot = fsedit::get_root($fstab, 'boot')->{device};
+ my $partition = first($boot =~ /\D*(\d*)/);
require c; c::initSilo() if arch() =~ /sparc/;
@@ -249,6 +267,17 @@ wait %d seconds for default boot.
root => "/dev/$root",
})->{append} .= " failsafe" unless $lilo->{password};
+ #- manage hackkernel if installed.
+ my $hasHack = -e "$prefix/boot/vmlinuz-hack";
+ if ($hasHack) {
+ my $hackVersion = first(readlink "$prefix/boot/vmlinuz-hack" =~ /vmlinux-(.*)/);
+ add_kernel($prefix, $lilo, $hackVersion, 'hack',
+ {
+ label => 'hack',
+ root => "/dev/$root",
+ });
+ }
+
if (arch() =~ /sparc/) {
#- search for SunOS, it could be a really better approach to take into account
#- partition type for mounting point.
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 6e1d2f28f..7adef9ce2 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -763,28 +763,14 @@ sub readBootloaderConfigBeforeInstall {
add2hash($o->{bootloader} ||= {}, bootloader::read($o->{prefix}, arch() =~ /sparc/ ? "/etc/silo.conf" : "/etc/lilo.conf"));
#- since kernel or kernel-smp may not be upgraded, it should be checked
- #- if there is a need to update existing lilo.conf entries by using that
- #- hash.
- my %ofpkgs = (
- 'vmlinuz' => pkgs::packageByName($o->{packages}, 'kernel'),
- 'vmlinuz-smp' => pkgs::packageByName($o->{packages}, 'kernel-smp'),
- );
-
- #- change the /boot/vmlinuz or /boot/vmlinuz-smp entries to follow symlink.
- foreach $image (keys %ofpkgs) {
- pkgs::packageFlagSelected($ofpkgs{$image}) or next;
- if (my $v = readlink "$o->{prefix}/boot/$image") {
+ #- if there is a need to update existing lilo.conf entries by following
+ #- symlinks before kernel or other packages get installed.
+ foreach my $e (@{$o->{bootloader}{entries}}) {
+ while (my $v = readlink "$o->{prefix}/$e->{kernel_or_dev}") {
$v = "/boot/$v" if $v !~ m|^/|;
- if (-e "$o->{prefix}$v") {
- my $e;
-
- require bootloader;
- $e = bootloader::get("/boot/$image", $o->{bootloader});
-
- $e or next;
- $e->{kernel_or_dev} = $v;
- log::l("renaming /boot/$image entry by $v");
- }
+ -e "$o->{prefix}$v" or next;
+ log::l("renaming /boot/$e->{kernel_or_dev} entry by $v");
+ $e->{kernel_or_dev} = $v;
}
}
}