diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-09-05 17:47:08 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-09-05 17:47:08 +0000 |
commit | 234c8d70cf522366d88a69dcf6da289c006976b6 (patch) | |
tree | bc2c6767ea0cfa30f30223d362405c77b877fb28 | |
parent | 352ed45ef47e58050e87d94f31c27c03e7dcafa0 (diff) | |
download | drakx-234c8d70cf522366d88a69dcf6da289c006976b6.tar drakx-234c8d70cf522366d88a69dcf6da289c006976b6.tar.gz drakx-234c8d70cf522366d88a69dcf6da289c006976b6.tar.bz2 drakx-234c8d70cf522366d88a69dcf6da289c006976b6.tar.xz drakx-234c8d70cf522366d88a69dcf6da289c006976b6.zip |
use name mangling for labels (taken from installkernel)
-rw-r--r-- | perl-install/bootloader.pm | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 8aa6850be..0b41bd5b9 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -196,7 +196,7 @@ sub add_kernel { symlinkf("initrd-$version.img", "$::prefix$initrd") or cp_af("$::prefix/boot/initrd-$version.img", "$::prefix$initrd"); } - my $label = $ext =~ /-(default)/ ? $1 : "linux$ext"; + my $label = $ext =~ /-(default)/ ? $1 : $ext =~ /\d\./ ? sanitize_ver("linux$ext") : "linux$ext"; #- more yaboot concessions - PPC if (arch() =~ /ppc/) { @@ -330,6 +330,46 @@ sub get_kernels_and_labels() { %labels; } +# sanitize_ver: long function when it could be shorter but we are sure +# to catch everything and can be readable if we want to +# add new scheme name. +# DUPLICATED from /usr/share/loader/common.pm +my $mdksub = "smp|enterprise|secure|linus|mosix|BOOT|custom"; + +sub sanitize_ver { + my $string = shift; + my $return; + (my $ehad, my $chtaim, my $chaloch, my $arba, my $hamesh, my $chech); #where that names come from ;) + + $string =~ m|([^-]+)-([^-]+)(-([^-]+))?(-([^-]*))?|; + $ehad = $1; $chtaim = $2; $chaloch = $3; $arba = $4; $hamesh = $5; $chech = $6; + + if ($chtaim =~ m|mdk| and $chech =~ m|mdk(${mdksub})|) { #new mdk with mdksub + my $s = $1; + $chtaim =~ m|^(\d+)\.(\d+)\.(\d+)\.(\d+)mdk|; + $return = "$1$2$3-$4$s"; + } elsif ($chtaim =~ m|mdk$|) { #new mdk + $chtaim =~ m|^(\d+)\.(\d+)\.(\d+)\.(\d+)mdk$|; + $return = "$1$2$3-$4"; + } elsif ($chaloch =~ m|(\d+)mdk(${mdksub})$|) { #old mdk with mdksub + my $s = "$1$2"; + $chtaim =~ m|^(\d+)\.(\d+)\.(\d+)|; + $return = "$1$2$3-$s"; + } elsif ($chaloch =~ m|(\d+)mdk$|) { #old mdk + my $s = $1; + $chtaim =~ m|^(\d+)\.(\d+)\.(\d+)|; + $return = "$1$2$3-$s"; + } elsif (not defined($chaloch)) { #linus/marcelo vanilla + $chtaim =~ m|^(\d+)\.(\d+)\.(\d+)$|; + $return = "$1$2$3"; + } else { #a pre ac vanilla or whatever with EXTRAVERSION + $chtaim =~ m|^(\d+)\.(\d+)\.(\d+)$|; + $return = "$1$2$3${chaloch}"; + } + $return =~ s|\.||g; $return =~ s|mdk||; $return =~ s|secure|sec|; $return =~ s|enterprise|ent|; + return $return; +} + sub suggest { my ($lilo, $hds, $fstab, %options) = @_; my $root_part = fsedit::get_root($fstab); |