diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-02-20 15:11:47 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-02-20 15:11:47 +0000 |
commit | ac8a9fbea5d45369f3a48fe518fd932682e44d7a (patch) | |
tree | c0e7f97d5efb6121f87f00ce5926c637e697a19e /perl-install/bootloader.pm | |
parent | f49ea815cc1c84571ebc34214aeff5ff668f62b9 (diff) | |
download | drakx-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.tar drakx-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.tar.gz drakx-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.tar.bz2 drakx-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.tar.xz drakx-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.zip |
- add "Force No APIC"
- rename add_append() to set_append()
(since it can be used to remove a key)
- add remove_append_simple()
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r-- | perl-install/bootloader.pm | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 82677b0b0..c60e84f77 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -270,7 +270,10 @@ sub append__mem_is_memsize { $_[0] =~ /^\d+[kM]?$/i } sub get_append { my ($b, $key) = @_; - my (undef, $dict) = unpack_append($b->{perImageAppend}); + my ($simple, $dict) = unpack_append($b->{perImageAppend}); + if (member($key, @$simple)) { + return 1; + } my @l = map { $_->[1] } grep { $_->[0] eq $key } @$dict; #- suppose we want the memsize @@ -279,20 +282,41 @@ sub get_append { log::l("more than one $key in $b->{perImageAppend}") if @l > 1; $l[0]; } -sub add_append { - my ($b, $key, $val) = @_; +sub modify_append { + my ($b, $f) = @_; foreach (\$b->{perImageAppend}, map { \$_->{append} } grep { $_->{type} eq 'image' } @{$b->{entries}}) { my ($simple, $dict) = unpack_append($$_); - @$dict = grep { $_->[0] ne $key || $key eq 'mem' && append__mem_is_memsize($_->[1]) != append__mem_is_memsize($val) } @$dict; - push @$dict, [ $key, $val ] if $val; + $f->($simple, $dict); $$_ = pack_append($simple, $dict); - log::l("add_append: $$_"); + log::l("modify_append: $$_"); } } +sub remove_append_simple { + my ($b, $key) = @_; + modify_append($b, sub { + my ($simple, $_dict) = @_; + @$simple = grep { $_ ne $key } @$simple; + }); +} +sub set_append { + my ($b, $key, $val) = @_; + my $has_val = @_ > 2; + + modify_append($b, sub { + my ($simple, $dict) = @_; + if ($has_val) { + @$dict = grep { $_->[0] ne $key || $key eq 'mem' && append__mem_is_memsize($_->[1]) != append__mem_is_memsize($val) } @$dict; + push @$dict, [ $key, $val ] if $val; + } else { + @$simple = grep { $_ ne $key } @$simple; + push @$simple, $key; + } + }); +} sub may_append { my ($b, $key, $val) = @_; - add_append($b, $key, $val) if !get_append($b, $key); + set_append($b, $key, $val) if !get_append($b, $key); } sub configure_entry { @@ -472,7 +496,7 @@ wait %d seconds for default boot. add2hash_($bootloader, { memsize => $1 }) if cat_("/proc/cmdline") =~ /\bmem=(\d+[KkMm]?)(?:\s.*)?$/; if (my ($s, $port, $speed) = cat_("/proc/cmdline") =~ /console=(ttyS(\d),(\d+)\S*)/) { log::l("serial console $s $port $speed"); - add_append($bootloader, 'console' => $s); + set_append($bootloader, 'console' => $s); any::set_login_serial_console($port, $speed); } |