summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-03-12 07:24:27 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-03-12 07:24:27 +0000
commit7ad37ff6c59a19f53c65b5d906c899ec97809898 (patch)
treecdb82abbfac0aaa15a770fce1584f9513236993a /perl-install
parent6279d17c19cb7ce69c9a76978a261f7fb4cb8f26 (diff)
downloaddrakx-backup-do-not-use-7ad37ff6c59a19f53c65b5d906c899ec97809898.tar
drakx-backup-do-not-use-7ad37ff6c59a19f53c65b5d906c899ec97809898.tar.gz
drakx-backup-do-not-use-7ad37ff6c59a19f53c65b5d906c899ec97809898.tar.bz2
drakx-backup-do-not-use-7ad37ff6c59a19f53c65b5d906c899ec97809898.tar.xz
drakx-backup-do-not-use-7ad37ff6c59a19f53c65b5d906c899ec97809898.zip
handle multiple removable devices: their managment is different from other hw
classes since we need to run a config tool per device and not one per hw class
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/harddrake/data.pm13
-rwxr-xr-xperl-install/standalone/harddrake22
-rwxr-xr-xperl-install/standalone/service_harddrake50
3 files changed, 41 insertions, 24 deletions
diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm
index cbddabfca..e355cf19e 100644
--- a/perl-install/harddrake/data.pm
+++ b/perl-install/harddrake/data.pm
@@ -26,11 +26,16 @@ sub unknown {
# FIXME: add translated items
+sub is_removable { $_[0] =~ /FLOPPY|ZIP|DVDROM|CDROM|BURNER/ }
+
sub set_removable_configurator {
- my ($class, $device, $configurator) = @_;
- if ($class =~ /FLOPPY|ZIP|DVDROM|CDROM|BURNER/) {
- $$configurator = "/usr/sbin/diskdrake --removable=$device->{device}";
- }
+ my ($class, $device) = @_;
+ return "/usr/sbin/diskdrake --removable=$device->{device}" if is_removable($class);
+}
+
+sub set_removable_remover {
+ my ($class, $device) = @_;
+ return "/usr/sbin/drakupdate_fstab --auto] --no-flag --del $device->{device}" if is_removable($class);
}
our @tree =
diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2
index 1910dc3b2..86d4f9e43 100755
--- a/perl-install/standalone/harddrake2
+++ b/perl-install/standalone/harddrake2
@@ -272,7 +272,7 @@ foreach (@harddrake::data::tree) {
my $i = $_;
$_->{bus_location} = join ':', map { sprintf("%lx", $i->{$_}) } qw(channel id lun);
}
- harddrake::data::set_removable_configurator($Ident, $_, \$configurator);
+ $configurator .= harddrake::data::set_removable_configurator($Ident, $_);
if ($Ident eq "AUDIO") {
require harddrake::sound;
my $alter = harddrake::sound::get_alternative($_->{driver});
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 8af36b163..309b58eb0 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -54,26 +54,38 @@ foreach (@harddrake::data::tree) {
$msg .= "- " . harddrake::data::custom_id($ID{$_}, $item) . " was added\n" foreach @added;
modules::load('ohci1394') if $Ident eq 'FIREWIRE_CONTROLLER' && any { $_->{driver} eq 'ohci1394' } @added;
@added || @was_removed or next;
- harddrake::data::set_removable_configurator($Ident, first(values %$oldconfig, values %ID), \$configurator);
- next unless -x first(split /\s+/, $configurator);
- my ($pid, $no);
- $SIG{ALRM} = sub { $no = 1; kill 15, $pid };
- unless ($pid = fork()) {
- exec("/usr/share/harddrake/confirm 'Hardware changes in $Ident class ($timeout seconds to answer)' '" . $msg . "Do you want to run the appropriate config tool ?'");
+ my @configurator_pool;
+ if (harddrake::data::is_removable($Ident)) {
+ foreach my $device (@ID{@added}) {
+ push @configurator_pool, harddrake::data::set_removable_configurator($Ident, $device);
+ };
+ foreach my $device (@{%$oldconfig}{@was_removed}) {
+ push @configurator_pool, harddrake::data::set_removable_remover($Ident, $device);
+ }
+ } else {
+ @configurator_pool = $configurator;
}
- alarm($timeout);
- wait();
- my $res = $?;
- alarm(0);
- if ($no) {
- require interactive;
- undef $wait;
- $in ||= interactive->vnew;
- $wait = $in->wait_message(N("Please wait"), N("Hardware probing in progress"));
- } elsif ($res) {
- if (fork()) {
- wait();
- } else { exec("$configurator 2>/dev/null") or die "$configurator missing\n" }
+ next unless -x first(split /\s+/, $configurator_pool[0]);
+ foreach my $configurator (@configurator_pool) {
+ my ($pid, $no);
+ $SIG{ALRM} = sub { $no = 1; kill 15, $pid };
+ unless ($pid = fork()) {
+ exec("/usr/share/harddrake/confirm 'Hardware changes in $Ident class ($timeout seconds to answer)' '" . $msg . "Do you want to run the appropriate config tool ?'");
+ }
+ alarm($timeout);
+ wait();
+ my $res = $?;
+ alarm(0);
+ if ($no) {
+ require interactive;
+ undef $wait;
+ $in ||= interactive->vnew;
+ $wait = $in->wait_message(N("Please wait"), N("Hardware probing in progress"));
+ } elsif ($res) {
+ if (fork()) {
+ wait();
+ } else { exec("$configurator 2>/dev/null") or die "$configurator missing\n" }
+ }
}
}