summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mageia.org>2011-04-20 23:32:50 +0000
committerAnssi Hannula <anssi@mageia.org>2011-04-20 23:32:50 +0000
commit1ce1be1f7b16c378de6b4eb4605b40374bece003 (patch)
treef7ac312fcdd7903e5bb4e4023b8980131d5c01c0 /perl-install
parent86b6cbea214a9254ab812470b9be9f138a86ce55 (diff)
downloaddrakx-backup-do-not-use-1ce1be1f7b16c378de6b4eb4605b40374bece003.tar
drakx-backup-do-not-use-1ce1be1f7b16c378de6b4eb4605b40374bece003.tar.gz
drakx-backup-do-not-use-1ce1be1f7b16c378de6b4eb4605b40374bece003.tar.bz2
drakx-backup-do-not-use-1ce1be1f7b16c378de6b4eb4605b40374bece003.tar.xz
drakx-backup-do-not-use-1ce1be1f7b16c378de6b4eb4605b40374bece003.zip
service_harddrake: add support for timeouted OK and Yes/No dialogs in
addition to the current OK/Cancel dialogs.
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/service_harddrake10
-rwxr-xr-xperl-install/standalone/service_harddrake_confirm11
2 files changed, 15 insertions, 6 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 244d27c12..fec9d8a72 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -76,14 +76,14 @@ 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) = @_;
+sub dialog_with_timeout {
+ my ($type, $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);
+ exec("/usr/share/harddrake/confirm", $type, $title, $msg);
}
alarm($timeout);
wait();
@@ -395,7 +395,7 @@ foreach my $hw_class (@harddrake::data::tree) {
$hw_class->{automatic} ||= ref($configurator) eq 'CODE';
if (!$hw_class->{automatic}) {
- ($res, $no) = ask_with_timeout(N("Hardware changes in \"%s\" class (%s seconds to answer)", $Ident, $timeout),
+ ($res, $no) = dialog_with_timeout("okcancel", 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;
@@ -434,7 +434,7 @@ Storable::store(\%config, $last_boot_config);
my ($reply, $timedout);
# Don't do autoreboot if X was somehow already started (not normally the case).
if ($reboot_needed && ! -e "/tmp/.X11-unix/X0") {
- ($reply, $timedout) = ask_with_timeout(N("Display driver setup"), N("The system has to be rebooted due to a display driver change.") . "\n\n"
+ ($reply, $timedout) = dialog_with_timeout("okcancel", N("Display driver setup"), N("The system has to be rebooted due to a display driver change.") . "\n\n"
. N("Press Cancel within %d seconds to abort.", 30), 30, $plymouth);
if ($reply || $timedout) {
exec("/sbin/reboot");
diff --git a/perl-install/standalone/service_harddrake_confirm b/perl-install/standalone/service_harddrake_confirm
index 914f644f8..f92807e2d 100755
--- a/perl-install/standalone/service_harddrake_confirm
+++ b/perl-install/standalone/service_harddrake_confirm
@@ -4,5 +4,14 @@ use common;
use interactive;
my $in = interactive->vnew;
-my $res = $in->ask_okcancel($ARGV[0], $ARGV[1], 1);
+my $res;
+
+if ($ARGV[0] eq "warn") {
+ $res = $in->ask_warn($ARGV[1], $ARGV[2]);
+} elsif ($ARGV[0] eq "yesorno") {
+ $res = $in->ask_yesorno($ARGV[1], $ARGV[2], 1);
+} elsif ($ARGV[0] eq "okcancel") {
+ $res = $in->ask_okcancel($ARGV[1], $ARGV[2], 1);
+}
+
$in->exit($res);