summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-09-06 13:06:20 +0000
committerOlivier Blin <oblin@mandriva.org>2005-09-06 13:06:20 +0000
commitcf3b9d22c8e469db908248cf514fc52369547658 (patch)
treefa6600e7c92875b9f7542c01f964383ad958747d /perl-install/network
parent498632dc58a1e10a170f3e35220a5228810a782e (diff)
downloaddrakx-cf3b9d22c8e469db908248cf514fc52369547658.tar
drakx-cf3b9d22c8e469db908248cf514fc52369547658.tar.gz
drakx-cf3b9d22c8e469db908248cf514fc52369547658.tar.bz2
drakx-cf3b9d22c8e469db908248cf514fc52369547658.tar.xz
drakx-cf3b9d22c8e469db908248cf514fc52369547658.zip
allow to run perl code as post command
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/thirdparty.pm20
1 files changed, 14 insertions, 6 deletions
diff --git a/perl-install/network/thirdparty.pm b/perl-install/network/thirdparty.pm
index 3f7f13007..a21524cdd 100644
--- a/perl-install/network/thirdparty.pm
+++ b/perl-install/network/thirdparty.pm
@@ -261,6 +261,18 @@ sub find_settings {
} @{$network_settings{$category}};
}
+sub device_run_command {
+ my ($settings, $option) = @_;
+ my $command = $settings->{$option} or return;
+
+ if (ref $command eq 'CODE') {
+ $command->();
+ } else {
+ log::explanations("Running $option command $command");
+ run_program::rooted($::prefix, $command);
+ }
+}
+
sub warn_not_installed {
my ($in, @packages) = @_;
$in->ask_warn(N("Error"), N("Could not install the packages (%s)!", @packages));
@@ -432,12 +444,8 @@ sub setup_device {
services::restart_or_start($service);
}
- if (my $post = $settings->{post}) {
- my $_w = $in->wait_message('', N("Please wait, running device configuration commands..."));
- log::explanations("Running post-install command $post");
- run_program::rooted($::prefix, $post);
- }
-
+ my $_wait = $in->wait_message('', N("Please wait, running device configuration commands..."));
+ device_run_command($settings, 'post');
log::explanations(qq(Settings for driver "$driver" applied));
} else {
log::explanations(qq(No settings found for driver "$driver" in category "$category"));