diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-09-06 13:06:20 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-09-06 13:06:20 +0000 |
commit | cf3b9d22c8e469db908248cf514fc52369547658 (patch) | |
tree | fa6600e7c92875b9f7542c01f964383ad958747d | |
parent | 498632dc58a1e10a170f3e35220a5228810a782e (diff) | |
download | drakx-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
-rw-r--r-- | perl-install/network/thirdparty.pm | 20 |
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")); |