From 4215d770341c72ec139ed5d5332d7406c08cde16 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 22 Jan 2002 22:08:51 +0000 Subject: - fix default not being formatted like labels for lilo - check the label is not already used *case-sensitively* - check a kernel_or_dev is given --- perl-install/any.pm | 3 ++- perl-install/bootloader.pm | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/perl-install/any.pm b/perl-install/any.pm index 3576c6ce8..f3ad81c22 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -307,7 +307,8 @@ if (arch() !~ /ppc/) { callbacks => { complete => sub { $e->{label} or $in->ask_warn('', _("Empty label not allowed")), return 1; - member($e->{label}, map { $_->{label} } grep { $_ != $e } @{$b->{entries}}) and $in->ask_warn('', _("This label is already used")), return 1; + $e->{kernel_or_dev} or $in->ask_warn('', $e->{type} eq 'image' ? _("You must specify a kernel image") : _("You must specify a root partition")), return 1; + member(lc $e->{label}, map { lc $_->{label} } grep { $_ != $e } @{$b->{entries}}) and $in->ask_warn('', _("This label is already used")), return 1; 0; } } }, \@l)) { $b->{default} = $old_default || $default ? $default && $e->{label} : $b->{default}; diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 5aff81522..366223713 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -632,6 +632,13 @@ sub install_silo($$$) { c::setPromVars($silo->{bootalias}, $silo->{bootdev}); } +sub make_label_lilo_compatible { + my ($label) = @_; + $label = substr($label, 0, 15); #- lilo doesn't handle more than 15 char long labels + $label =~ s/\s/_/g; #- lilo doesn't like spaces + $label; +} + sub write_lilo_conf { my ($prefix, $lilo, $fstab, $hds) = @_; $lilo->{prompt} = $lilo->{timeout}; @@ -678,6 +685,7 @@ sub write_lilo_conf { open F, ">$f" or die "cannot create lilo config file: $f"; log::l("writing lilo config to $f"); + local $lilo->{default} = make_label_lilo_compatible($lilo->{default}); $lilo->{$_} and print F "$_=$lilo->{$_}" foreach qw(boot map install vga default append keytable); $lilo->{$_} and print F $_ foreach qw(linear lba32 compact prompt restricted); print F "password=", $lilo->{password} if $lilo->{restricted} && $lilo->{password}; #- also done by msec @@ -699,9 +707,7 @@ sub write_lilo_conf { foreach (@{$lilo->{entries}}) { print F "$_->{type}=", $file2fullname->($_->{kernel_or_dev}); - my $label = substr($_->{label}, 0, 15); #- lilo doesn't handle more than 15 char long labels - $label =~ s/\s/_/g; #- lilo doesn't like spaces - print F "\tlabel=$label"; + print F "\tlabel=", make_label_lilo_compatible($_->{label}); if ($_->{type} eq "image") { print F "\troot=$_->{root}"; -- cgit v1.2.1