diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-08-08 00:41:59 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-08-08 00:41:59 +0000 |
commit | 909309f431897fa7a6601d58a45590157323d2e1 (patch) | |
tree | e59fd497df5da78c640c3de017f850f3570ee138 /perl-install | |
parent | 2bda801375131eadb2c2b24546f42cef39d14ec9 (diff) | |
download | drakx-backup-do-not-use-909309f431897fa7a6601d58a45590157323d2e1.tar drakx-backup-do-not-use-909309f431897fa7a6601d58a45590157323d2e1.tar.gz drakx-backup-do-not-use-909309f431897fa7a6601d58a45590157323d2e1.tar.bz2 drakx-backup-do-not-use-909309f431897fa7a6601d58a45590157323d2e1.tar.xz drakx-backup-do-not-use-909309f431897fa7a6601d58a45590157323d2e1.zip |
it's better to warn package installation failure in ensure_is_installed than each callers (bugzilla #17251)
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/do_pkgs.pm | 10 | ||||
-rw-r--r-- | perl-install/network/netconnect.pm | 15 | ||||
-rwxr-xr-x | perl-install/standalone/drakgw | 20 |
3 files changed, 17 insertions, 28 deletions
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm index f8ed44028..f155a5c84 100644 --- a/perl-install/do_pkgs.pm +++ b/perl-install/do_pkgs.pm @@ -15,7 +15,10 @@ sub ensure_is_installed { if (! $o_file || ! -e "$::prefix$o_file") { $do->in->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $pkg), 1) or return if !$b_auto; - $do->install($pkg) or return; + if (!$do->install($pkg)) { + $do->in->ask_warn(N("Error"), N("Could not install the %s package!", $pkg)); + return; + } } if ($o_file && ! -e "$::prefix$o_file") { $do->in->ask_warn('', N("Mandatory package %s is missing", $pkg)); @@ -30,7 +33,10 @@ sub ensure_binary_is_installed { if (!whereis_binary($binary, $::prefix)) { $do->in->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $pkg), 1) or return if !$b_auto; - $do->install($pkg) or return; + if (!$do->install($pkg)) { + $do->in->ask_warn(N("Error"), N("Could not install the %s package!", $pkg)); + return; + } } if (!whereis_binary($binary, $::prefix)) { $do->in->ask_warn('', N("Mandatory package %s is missing", $pkg)); diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 1f7786c71..025210a23 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -810,10 +810,7 @@ If you do not know, choose 'use PPPoE'"), complete => sub { if ($ntf_name eq "Use a Windows driver (with ndiswrapper)") { require network::ndiswrapper; - unless ($in->do_pkgs->ensure_is_installed('ndiswrapper', '/usr/sbin/ndiswrapper')) { - $in->ask_warn(N("Error"), N("Could not install the %s package!", 'ndiswrapper')); - return 1; - } + $in->do_pkgs->ensure_is_installed('ndiswrapper', '/usr/sbin/ndiswrapper') or return 1; undef $ndiswrapper_driver; undef $ndiswrapper_device; unless (network::ndiswrapper::installed_drivers()) { @@ -1069,14 +1066,12 @@ See iwpriv(8) man page for further information."), $in->ask_warn(N("Error"), N("Rate should have the suffix k, M or G (for example, \"11M\" for 11M), or add enough '0' (zeroes).")); return 1, 8; } - if (network::wireless::wlan_ng_needed($module) && !$in->do_pkgs->ensure_is_installed('prism2-utils', '/sbin/wlanctl-ng')) { - $in->ask_warn(N("Error"), N("Could not install the %s package!", 'prism2-utils')); - return 1; + if (network::wireless::wlan_ng_needed($module)) { + $in->do_pkgs->ensure_is_installed('prism2-utils', '/sbin/wlanctl-ng') or return 1; } $need_wpa_supplicant = ($wireless_roaming || $wireless_enc_mode eq 'wpa-psk') && !$need_rt2x00_iwpriv; - if ($need_wpa_supplicant && !$in->do_pkgs->ensure_is_installed('wpa_supplicant', '/usr/sbin/wpa_supplicant')) { - $in->ask_warn(N("Error"), N("Could not install the %s package!", 'wpa_supplicant')); - return 1; + if ($need_wpa_supplicant) { + $in->do_pkgs->ensure_is_installed('wpa_supplicant', '/usr/sbin/wpa_supplicant') or return 1; } !network::thirdparty::setup_device($in, 'wireless', $module); }, diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw index 5fcbe5f3c..bccf75c24 100755 --- a/perl-install/standalone/drakgw +++ b/perl-install/standalone/drakgw @@ -213,10 +213,7 @@ I am about to setup your Local Area Network with that adapter.", format_interfac $dhcpd_conf->{domain_name_servers}[0] eq $lan_intf->{IPADDR} or return 0; !$use_caching_dns || $::testing and return 0; #- install a caching name server if the specified DNS is the gateway - unless ($in->do_pkgs->ensure_is_installed('caching-nameserver', '/var/named/named.local')) { - $in->ask_warn(N("Error"), N("Could not install the %s package!", 'caching-nameserver')); - return 1; - } + $in->do_pkgs->ensure_is_installed('caching-nameserver', '/var/named/named.local') or return 1; 0; }, post => sub { @@ -254,10 +251,7 @@ If you do not know the meaning of an option, simply leave it as it is."), }, complete => sub { !$use_dhcpd || $::testing and return 0; - unless ($in->do_pkgs->ensure_is_installed('dhcp-server', '/usr/sbin/dhcpd')) { - $in->ask_warn(N("Error"), N("Could not install the %s package!", 'dhcp-server')); - return 1; - } + $in->do_pkgs->ensure_is_installed('dhcp-server', '/usr/sbin/dhcpd') or return 1; 0; }, post => sub { @@ -288,10 +282,7 @@ If you do not know the meaning of an option, simply leave it as it is."), }, complete => sub { !$use_caching_proxy || $::testing and return 0; - unless ($in->do_pkgs->ensure_is_installed('squid', '/usr/sbin/squid')) { - $in->ask_warn(N("Error"), N("Could not install the %s package!", 'squid')); - return 1; - } + $in->do_pkgs->ensure_is_installed('squid', '/usr/sbin/squid') or return 1; 0; }, post => sub { @@ -390,10 +381,7 @@ sub gw_configure() { N("Warning! An existing firewalling configuration has been detected. You may need some manual fixes after installation.")); } - unless ($in->do_pkgs->ensure_is_installed('shorewall', '/sbin/shorewall')) { - $in->ask_warn(N("Error"), N("Could not install the %s package!", 'shorewall')); - $in->exit(-1); - } + $in->do_pkgs->ensure_is_installed('shorewall', '/sbin/shorewall') or $in->exit(-1); my $_wait_configuring = $in->wait_message(N("Configuring..."), N("Configuring firewall...")); |