summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-14 13:51:03 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-14 13:51:03 +0000
commit0705875070ff63efff135fc56538022b858ca822 (patch)
treea6822f6942d9fa0728aa5d6d41844b6da4fb6365 /lib
parent33dfcba919dc587ea3724f194b6639b90514efc1 (diff)
downloaddrakx-net-0705875070ff63efff135fc56538022b858ca822.tar
drakx-net-0705875070ff63efff135fc56538022b858ca822.tar.gz
drakx-net-0705875070ff63efff135fc56538022b858ca822.tar.bz2
drakx-net-0705875070ff63efff135fc56538022b858ca822.tar.xz
drakx-net-0705875070ff63efff135fc56538022b858ca822.zip
rename install_packages as more generic install_components and split
packages specific function out
Diffstat (limited to 'lib')
-rw-r--r--lib/network/thirdparty.pm56
1 files changed, 33 insertions, 23 deletions
diff --git a/lib/network/thirdparty.pm b/lib/network/thirdparty.pm
index ef510ff..9ac932f 100644
--- a/lib/network/thirdparty.pm
+++ b/lib/network/thirdparty.pm
@@ -291,32 +291,42 @@ sub user_install {
}
sub install_packages {
+ my ($in, $settings, $driver, $option, @packages) = @_;
+
+ unless (@packages) {
+ log::explanations(qq(No $option package for module "$driver" is required, skipping));
+ return 1;
+ }
+
+ if (check_installed($option, $settings, $driver)) {
+ $settings->{old_status}{$option} = 1;
+ log::explanations(qq(Required $option package for module "$driver" is already installed, skipping));
+ return 1;
+ }
+
+ my $optional = ref $settings->{$option} eq 'HASH' && $settings->{$option}{optional};
+ if (my @available = get_available_packages($option, $in, @packages)) {
+ log::explanations("Installing thirdparty packages ($option) " . join(', ', @available));
+ if ($in->do_pkgs->install(@available) && check_installed($option, $settings, $driver)) {
+ return 1;
+ } elsif (!$optional) {
+ warn_not_installed($in, @available);
+ }
+ }
+ return 1 if $optional;
+ log::explanations("Thirdparty package @packages ($option) is required but not available");
+
+ 0;
+}
+
+sub install_components {
my ($in, $settings, $driver, @options) = @_;
foreach my $option (@options) {
my @packages = get_required_packages($option, $settings);
- unless (@packages) {
- log::explanations(qq(No $option package for module "$driver" is required, skipping));
- next;
- }
-
- if (check_installed($option, $settings, $driver)) {
- $settings->{old_status}{$option} = 1;
- log::explanations(qq(Required $option package for module "$driver" is already installed, skipping));
- next;
- }
-
- my $optional = ref $settings->{$option} eq 'HASH' && $settings->{$option}{optional};
- if (my @available = get_available_packages($option, $in, @packages)) {
- log::explanations("Installing thirdparty packages ($option) " . join(', ', @available));
- if ($in->do_pkgs->install(@available) && check_installed($option, $settings, $driver)) {
- next;
- } elsif (!$optional) {
- warn_not_installed($in, @available);
- }
- }
- next if $optional;
- log::explanations("Thirdparty package @packages ($option) is required but not available");
+ if (!component_get_option($settings, $option, 'no_package')) {
+ install_packages($in, $settings, $driver, $option, @packages) and next;
+ }
unless (user_install($option, $settings, $in)) {
warn_not_found($in, $settings, $driver, $option, @packages);
@@ -336,7 +346,7 @@ sub apply_settings {
my $wait = $in->wait_message(N("Please wait"), N("Looking for required software and drivers..."));
- install_packages($in, $settings, $driver, @thirdparty_types) or return;
+ install_components($in, $settings, $driver, @thirdparty_types) or return;
if (!$settings->{no_module_reload}) {
if (exists $settings->{firmware} && !$settings->{old_status}{firmware}) {