summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-10-27 09:25:37 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-10-27 09:25:37 +0000
commit544a1b148cac7d4e3ad3ea8b4095ca3546230296 (patch)
tree3884ab1ef76adf2de05fece719b78c38bc67b220
parent9d4845f779a1486cf265064b1c8e3c0c5177c197 (diff)
downloaddrakx-544a1b148cac7d4e3ad3ea8b4095ca3546230296.tar
drakx-544a1b148cac7d4e3ad3ea8b4095ca3546230296.tar.gz
drakx-544a1b148cac7d4e3ad3ea8b4095ca3546230296.tar.bz2
drakx-544a1b148cac7d4e3ad3ea8b4095ca3546230296.tar.xz
drakx-544a1b148cac7d4e3ad3ea8b4095ca3546230296.zip
- handle setting memsize mem= kernel parameter in a special function
- rely on pack_append() to remove dups (using $uniq_dict_appends) in set_append_with_key() (drawback: it doesn't keep the order anymore)
-rw-r--r--perl-install/any.pm4
-rw-r--r--perl-install/bootloader.pm38
2 files changed, 24 insertions, 18 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 817ffab51..bf0678fc7 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -231,7 +231,7 @@ sub setupBootloader__general {
my $prev_force_acpi = my $force_acpi = bootloader::get_append_with_key($b, 'acpi') !~ /off|ht/;
my $prev_force_noapic = my $force_noapic = bootloader::get_append_simple($b, 'noapic');
my $prev_force_nolapic = my $force_nolapic = bootloader::get_append_simple($b, 'nolapic');
- my $memsize = bootloader::get_append_with_key($b, 'mem');
+ my $memsize = bootloader::get_append_memsize($b);
my $prev_clean_tmp = my $clean_tmp = any { $_->{mntpoint} eq '/tmp' } @{$all_hds->{special} ||= []};
my $prev_boot = $b->{boot};
@@ -297,7 +297,7 @@ sub setupBootloader__general {
$in->do_pkgs->ensure_binary_is_installed('grub', "grub", 1) or return 0;
}
- bootloader::set_append_with_key($b, mem => $memsize || 0);
+ bootloader::set_append_memsize($b, $memsize);
if ($prev_force_acpi != $force_acpi) {
bootloader::set_append_with_key($b, acpi => ($force_acpi ? '' : 'ht'));
}
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index d0be63cf4..65ddf0d1d 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -535,9 +535,6 @@ sub get_append_with_key {
my ($_simple, $dict) = unpack_append($b->{perImageAppend});
my @l = map { $_->[1] } grep { $_->[0] eq $key } @$dict;
- #- suppose we want the memsize
- @l = grep { append__mem_is_memsize($_) } @l if $key eq 'mem';
-
log::l("more than one $key in $b->{perImageAppend}") if @l > 1;
$l[0];
}
@@ -554,19 +551,11 @@ sub set_append_with_key {
modify_append($b, sub {
my ($_simple, $dict) = @_;
- my $to_add = $key eq 'mem' ? $val : $val ne '';
- @$dict = map {
- if ($_->[0] ne $key || $key eq 'mem' && append__mem_is_memsize($_->[1]) != append__mem_is_memsize($val)) {
- $_;
- } elsif ($to_add) {
- $to_add = 0;
- [ $key, $val ];
- } else {
- ();
- }
- } @$dict;
-
- push @$dict, [ $key, $val ] if $to_add;
+ if ($val eq '') {
+ @$dict = grep { $_ ne $key } @$dict;
+ } else {
+ push @$dict, [ $key, $val ];
+ }
});
}
sub set_append_simple {
@@ -582,6 +571,23 @@ sub may_append_with_key {
set_append_with_key($b, $key, $val) if !get_append_with_key($b, $key);
}
+sub get_append_memsize {
+ my ($b) = @_;
+ my ($_simple, $dict) = unpack_append($b->{perImageAppend});
+ find { $_->[0] eq 'mem' && append__mem_is_memsize($_->[1]) } @$dict;
+}
+
+sub set_append_memsize {
+ my ($b, $memsize) = @_;
+
+ modify_append($b, sub {
+ my ($_simple, $dict) = @_;
+
+ @$dict = grep { $_->[0] ne 'mem' || !append__mem_is_memsize($_->[1]) } @$dict;
+ push @$dict, [ mem => $memsize ] if $memsize;
+ });
+}
+
sub get_append_netprofile {
my ($e) = @_;
my ($simple, $dict) = unpack_append($e->{append});