summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mandriva.org>2011-04-17 11:08:05 +0000
committerAnssi Hannula <anssi@mandriva.org>2011-04-17 11:08:05 +0000
commite8768b71c45803e582da0fd1edbfa79030d38c7a (patch)
tree615becb734a09ad156afd9be932a835faf8a1924 /perl-install/standalone
parentbb620fe4d0afc1b724038a050ebc8394a42b57cf (diff)
downloaddrakx-e8768b71c45803e582da0fd1edbfa79030d38c7a.tar
drakx-e8768b71c45803e582da0fd1edbfa79030d38c7a.tar.gz
drakx-e8768b71c45803e582da0fd1edbfa79030d38c7a.tar.bz2
drakx-e8768b71c45803e582da0fd1edbfa79030d38c7a.tar.xz
drakx-e8768b71c45803e582da0fd1edbfa79030d38c7a.zip
service_harddrake: Factorize ask_with_timeout for a following commit.
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/service_harddrake29
-rwxr-xr-xperl-install/standalone/service_harddrake_confirm3
2 files changed, 20 insertions, 12 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 9de83cf71..1b0f87065 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -72,6 +72,22 @@ if (!member($curr_kernel, chomp_(cat_($known_kernels)))) {
append_to_file($known_kernels, "$curr_kernel\n");
}
+sub ask_with_timeout {
+ my ($title, $msg, $timeout, $plymouth) = @_;
+ my ($pid, $res, $timed_out);
+
+ $SIG{ALRM} = sub { $timed_out = 1; kill 15, $pid };
+ unless ($pid = fork()) {
+ $plymouth and system('plymouth', 'hide-splash');
+ exec("/usr/share/harddrake/confirm", $title, $msg);
+ }
+ alarm($timeout);
+ wait();
+ $res = $?;
+ alarm(0);
+ return $res, $timed_out;
+}
+
sub get_xorg_driver() {
my $x = Xconfig::xfree->read;
if ($x) {
@@ -332,19 +348,12 @@ foreach my $hw_class (@harddrake::data::tree) {
log::explanations(qw(skip $Ident configuration since "$configurator" is not executable));
next;
}
- my ($pid, $no, $res);
+ my ($no, $res);
$hw_class->{automatic} ||= ref($configurator) eq 'CODE';
if (!$hw_class->{automatic}) {
- $SIG{ALRM} = sub { $no = 1; kill 15, $pid };
- unless ($pid = fork()) {
- $plymouth and system('plymouth', 'hide-splash');
- exec("/usr/share/harddrake/confirm", $Ident, $timeout, $msg);
- }
- alarm($timeout);
- wait();
- $res = $?;
- alarm(0);
+ ($res, $no) = ask_with_timeout(N("Hardware changes in \"%s\" class (%s seconds to answer)", $Ident, $timeout),
+ $msg . N("Do you want to run the appropriate config tool?"), $timeout, $plymouth);
} else {
$res = 1;
}
diff --git a/perl-install/standalone/service_harddrake_confirm b/perl-install/standalone/service_harddrake_confirm
index 1528fd9bf..914f644f8 100755
--- a/perl-install/standalone/service_harddrake_confirm
+++ b/perl-install/standalone/service_harddrake_confirm
@@ -4,6 +4,5 @@ use common;
use interactive;
my $in = interactive->vnew;
-my $res = $in->ask_okcancel(N("Hardware changes in \"%s\" class (%s seconds to answer)", $ARGV[0], $ARGV[1]),
- $ARGV[2] . N("Do you want to run the appropriate config tool?"), 1);
+my $res = $in->ask_okcancel($ARGV[0], $ARGV[1], 1);
$in->exit($res);