summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-20 15:11:47 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-20 15:11:47 +0000
commitac8a9fbea5d45369f3a48fe518fd932682e44d7a (patch)
treec0e7f97d5efb6121f87f00ce5926c637e697a19e /perl-install
parentf49ea815cc1c84571ebc34214aeff5ff668f62b9 (diff)
downloaddrakx-backup-do-not-use-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.tar
drakx-backup-do-not-use-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.tar.gz
drakx-backup-do-not-use-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.tar.bz2
drakx-backup-do-not-use-ac8a9fbea5d45369f3a48fe518fd932682e44d7a.tar.xz
drakx-backup-do-not-use-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')
-rw-r--r--perl-install/any.pm17
-rw-r--r--perl-install/bootloader.pm40
-rw-r--r--perl-install/install_steps.pm15
3 files changed, 50 insertions, 22 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 235033fa9..779f8fd11 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -239,8 +239,8 @@ sub setupBootloader__general {
($b->{method}, my $method_choices) = bootloader::method_choices($fstab);
my $profiles = bootloader::has_profiles($b);
- my $previous_acpi_val = bootloader::get_append($b, 'acpi');
- my $force_acpi = $previous_acpi_val eq 'on';
+ my $prev_force_acpi = my $force_acpi = bootloader::get_append($b, 'acpi') ne 'off';
+ my $prev_force_noapic = my $force_noapic = bootloader::get_append($b, 'noapic');
my $memsize = bootloader::get_append($b, 'mem');
my $prev_clean_tmp = my $clean_tmp = any { $_->{mntpoint} eq '/tmp' } @{$all_hds->{special} ||= []};
my $prev_boot = $b->{boot};
@@ -261,9 +261,8 @@ sub setupBootloader__general {
{ label => N("Video mode"), val => \$b->{vga}, list => [ keys %bootloader::vga_modes ], not_edit => !$::expert, format => sub { $bootloader::vga_modes{$_[0]} }, advanced => 1 },
),
{ label => N("Delay before booting default image"), val => \$b->{timeout} },
- if_($previous_acpi_val,
{ label => N("Force ACPI"), val => \$force_acpi, type => 'bool' },
- ),
+ { label => N("Force No APIC"), val => \$force_noapic, type => 'bool' },
if_($security >= 4 || $b->{password} || $b->{restricted},
{ label => N("Password"), val => \$b->{password}, hidden => 1 },
{ label => N("Password (again)"), val => \$b->{password2}, hidden => 1 },
@@ -309,10 +308,12 @@ sub setupBootloader__general {
}
bootloader::set_profiles($b, $profiles);
- bootloader::add_append($b, "mem", $memsize);
- if ($previous_acpi_val) {
- my $s = $force_acpi ? 'on' : 'off';
- bootloader::add_append($b, acpi => $s) if $s ne $previous_acpi_val;
+ bootloader::set_append($b, "mem", $memsize);
+ if ($prev_force_acpi != $force_acpi) {
+ bootloader::set_append($b, acpi => ($force_acpi ? '' : 'off'));
+ }
+ if ($prev_force_noapic != $force_noapic) {
+ ($force_noapic ? \&bootloader::set_append : \&bootloader::remove_append_simple)->($b, 'noapic');
}
if ($prev_clean_tmp != $clean_tmp) {
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);
}
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 7bb4a8101..d4c2826e6 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -823,19 +823,22 @@ sub setupBootloaderBefore {
require bootloader;
if (my @l = (grep { $_->{bus} eq 'ide' } detect_devices::burners(), detect_devices::raw_zips())) {
- bootloader::add_append($o->{bootloader}, $_->{device}, 'ide-scsi') foreach @l;
+ bootloader::set_append($o->{bootloader}, $_->{device}, 'ide-scsi') foreach @l;
}
if ($o->{miscellaneous}{HDPARM}) {
- bootloader::add_append($o->{bootloader}, $_, 'autotune') foreach grep { /ide.*/ } all("/proc/ide");
+ bootloader::set_append($o->{bootloader}, $_, 'autotune') foreach grep { /ide.*/ } all("/proc/ide");
}
if (cat_("/proc/cmdline") =~ /mem=nopentium/) {
- bootloader::add_append($o->{bootloader}, 'mem', 'nopentium');
+ bootloader::set_append($o->{bootloader}, 'mem', 'nopentium');
}
if (cat_("/proc/cmdline") =~ /\b(pci)=(\S+)/) {
- bootloader::add_append($o->{bootloader}, $1, $2);
+ bootloader::set_append($o->{bootloader}, $1, $2);
}
- if (my ($acpi) = cat_("/proc/cmdline") =~ /\bacpi=(\S+)/) {
- bootloader::add_append($o->{bootloader}, acpi => $acpi);
+ if (cat_("/proc/cmdline") =~ /\bacpi=off/) {
+ bootloader::set_append($o->{bootloader}, acpi => 'off');
+ }
+ if (cat_("/proc/cmdline") =~ /\bnoapic/) {
+ bootloader::set_append($o->{bootloader}, 'noapic');
}
if (arch() =~ /alpha/) {