summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/service_harddrake
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mageia.org>2011-04-17 14:33:49 +0000
committerAnssi Hannula <anssi@mageia.org>2011-04-17 14:33:49 +0000
commit978f0bb73d45dfb4411cc28bfe3585477acdd0cc (patch)
treeaedcff64061ba2e58f184b8d492d1c97e3f481fe /perl-install/standalone/service_harddrake
parentd002efb5c6cae59da09da2371fb59c821e1c499f (diff)
downloaddrakx-978f0bb73d45dfb4411cc28bfe3585477acdd0cc.tar
drakx-978f0bb73d45dfb4411cc28bfe3585477acdd0cc.tar.gz
drakx-978f0bb73d45dfb4411cc28bfe3585477acdd0cc.tar.bz2
drakx-978f0bb73d45dfb4411cc28bfe3585477acdd0cc.tar.xz
drakx-978f0bb73d45dfb4411cc28bfe3585477acdd0cc.zip
service_harddrake: Factorize ask_with_timeout for a following commit.
Diffstat (limited to 'perl-install/standalone/service_harddrake')
-rwxr-xr-xperl-install/standalone/service_harddrake29
1 files changed, 19 insertions, 10 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 19333172e..80c071897 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;
}