summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-02-26 21:41:31 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-02-26 21:41:31 +0000
commitab468a0bddd333f206aca7b4d33ec74451267910 (patch)
tree3576d25b0b819da2645e80fb8a2a065330806ba6 /perl-install
parentf2c80a79f73daa02590dcd8ce828058fc6f85770 (diff)
downloaddrakx-ab468a0bddd333f206aca7b4d33ec74451267910.tar
drakx-ab468a0bddd333f206aca7b4d33ec74451267910.tar.gz
drakx-ab468a0bddd333f206aca7b4d33ec74451267910.tar.bz2
drakx-ab468a0bddd333f206aca7b4d33ec74451267910.tar.xz
drakx-ab468a0bddd333f206aca7b4d33ec74451267910.zip
if no sound card are detected AND the user selected things needing a sound card, propose a special case for ISA cards
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install_steps_interactive.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index b263d6634..b81b2228d 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -1024,6 +1024,21 @@ sub summary {
return _("Remote CUPS server"); #- fall back in case of something wrong.
};
+ my @sound_cards = arch() !~ /ppc/ ? modules::get_that_type('sound') : modules::load_thiskind('sound');
+
+ #- if no sound card are detected AND the user selected things needing a sound card,
+ #- propose a special case for ISA cards
+ my $isa_sound_card =
+ !@sound_cards && ($o->{compssUsersChoice}{GAMES} || $o->{compssUsersChoice}{AUDIO}) &&
+ sub {
+ if ($o->ask_yesorno('', _("Do you have an ISA sound card?"))) {
+ $o->do_pkgs->install('sndconfig');
+ $o->ask_warn('', _("Run \"sndconfig\" after installation to configure your sound card"));
+ } else {
+ $o->ask_warn('', _("No sound card detected. Try \"harddrake\" after installation"));
+ }
+ };
+
$o->ask_from_({
messages => _("Summary"),
cancel => '',
@@ -1037,7 +1052,8 @@ sub summary {
} grep { $_->{driver} eq 'hisax' } detect_devices::probeall()),
(map {
{ label => _("Sound card"), val => $_->{description} }
- } arch() !~ /ppc/ ? modules::get_that_type('sound') : modules::load_thiskind('sound')),
+ } @sound_cards),
+ if_($isa_sound_card, { label => _("Sound card"), clicked => $isa_sound_card }),
(map {
{ label => _("TV card"), val => $_->{description} }
} grep { $_->{driver} eq 'bttv' } detect_devices::probeall()),
">failed\n"; } sub get_stdout { my ($name, @args) = @_; my @r; run($name, '>', \@r, @args) or return; wantarray() ? @r : join('', @r); } sub rooted_get_stdout { my ($root, $name, @args) = @_; my @r; rooted($root, $name, '>', \@r, @args) or return; wantarray() ? @r : join('', @r); } sub run { raw({}, @_) } sub rooted { my ($root, $name, @args) = @_; raw({ root => $root }, $name, @args); } sub raw { my ($options, $name, @args) = @_; my $root = $options->{root} || ''; my $str = ref($name) ? $name->[0] : $name; my ($stdout_raw, $stdout_mode, $stderr_raw, $stderr_mode); ($stdout_mode, $stdout_raw, @args) = @args if $args[0] =~ /^>>?$/; ($stderr_mode, $stderr_raw, @args) = @args if $args[0] =~ /^2>>?$/; log::l("running: $str @args" . ($root ? " with root $root" : "")); return 1 if $root && $<; $root ? ($root .= '/') : ($root = ''); if (!$root && !$::isStandalone) { require install_any; install_any::check_prog(ref($name) ? $name->[0] : $name); } $ENV{HOME} || $::isInstall or $ENV{HOME} = '/root'; my $tmpdir = sub { my $dir = "$ENV{HOME}/tmp"; -d $dir or mkdir($dir, 0700); $dir; }; my $stdout = $stdout_raw && (ref($stdout_raw) ? $tmpdir->() . "/.drakx-stdout.$$" : "$root$stdout_raw"); my $stderr = $stderr_raw && (ref($stderr_raw) ? $tmpdir->() . "/.drakx-stderr.$$" : "$root$stderr_raw"); if (my $pid = fork()) { if ($options->{detach}) { $pid; } else { my $ok; eval { local $SIG{ALRM} = sub { die "ALARM" }; alarm($options->{timeout} || 10 * 60); waitpid $pid, 0; $ok = $? == 0; alarm 0; }; if ($@) { log::l("ERROR: killing runaway process (process=$str, pid=$pid, args=@args, error=$@)"); kill 9, $pid; return; } if ($stdout_raw && ref($stdout_raw)) { if (ref($stdout_raw) eq 'ARRAY') { @$stdout_raw = cat_($stdout); } else { $$stdout_raw = cat_($stdout); } unlink $stdout; } if ($stderr_raw && ref($stderr_raw)) { if (ref($stderr_raw) eq 'ARRAY') { @$stderr_raw = cat_($stderr); } else { $$stderr_raw = cat_($stderr); } unlink $stderr; } $ok; } } else { if ($stderr && $stderr eq 'STDERR') { } elsif ($stderr) { $stderr_mode =~ s/2//; open STDERR, "$stderr_mode $stderr" or die "run_program can't output in $stderr (mode `$stderr_mode')"; } elsif ($::isInstall) { open STDERR, ">> /tmp/ddebug.log" or open STDOUT, ">> /dev/tty7" or die "run_program can't log, give me access to /tmp/ddebug.log"; } if ($stdout && $stdout eq 'STDOUT') { } elsif ($stdout) { open STDOUT, "$stdout_mode $stdout" or die "run_program can't output in $stdout (mode `$stdout_mode')"; } elsif ($::isInstall) { open STDOUT, ">> /tmp/ddebug.log" or open STDOUT, ">> /dev/tty7" or die "run_program can't log, give me access to /tmp/ddebug.log"; } $root and chroot $root; chdir "/"; if (ref $name) { unless (exec { $name->[0] } $name->[1], @args) { log::l("exec of $name->[0] failed: $!"); c::_exit(128); } } else { unless (exec $name, @args) { log::l("exec of $name failed: $!"); c::_exit(128); } } } } # run in background a sub that give back data through STDOUT a la run_program::get_stdout but w/ arbitrary perl code instead of external program package bg_command; sub new { my ($class, $sub) = @_; my $o = bless {}, $class; if ($o->{pid} = open(my $fd, "-|")) { $o->{fd} = $fd; $o; } else { $sub->(); c::_exit(0); } } sub DESTROY { my ($o) = @_; close $o->{fd} or warn "kid exited $?"; waitpid $o->{pid}, 0; } 1;