summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-08-02 06:52:22 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-08-02 06:52:22 +0000
commitdb02946e5f58e282d5056a57d50208022f2fc796 (patch)
tree7755a8abb9c238d4e6405c546c516a7e2458114c
parent16c8467a9f303721a889bf4248ae02ad178fa471 (diff)
downloaddrakx-db02946e5f58e282d5056a57d50208022f2fc796.tar
drakx-db02946e5f58e282d5056a57d50208022f2fc796.tar.gz
drakx-db02946e5f58e282d5056a57d50208022f2fc796.tar.bz2
drakx-db02946e5f58e282d5056a57d50208022f2fc796.tar.xz
drakx-db02946e5f58e282d5056a57d50208022f2fc796.zip
introduce ->ensure_binary_is_installed and use it
-rw-r--r--perl-install/any.pm2
-rw-r--r--perl-install/diskdrake/dav.pm2
-rw-r--r--perl-install/do_pkgs.pm15
-rw-r--r--perl-install/harddrake/sound.pm2
-rw-r--r--perl-install/lvm.pm2
-rw-r--r--perl-install/network/drakfirewall.pm2
-rw-r--r--perl-install/network/netconnect.pm2
-rw-r--r--perl-install/network/network.pm6
-rw-r--r--perl-install/network/nfs.pm2
-rw-r--r--perl-install/network/smb.pm2
-rwxr-xr-xperl-install/standalone/drakups2
-rwxr-xr-xperl-install/standalone/drakxtv2
12 files changed, 28 insertions, 13 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 33b90956e..c0c25ed13 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -249,7 +249,7 @@ sub setupBootloader__general {
delete $b->{bios} if $b->{boot} ne $prev_boot;
if ($b->{method} eq 'grub') {
- $in->do_pkgs->ensure_is_installed('grub', "/usr/sbin/grub", 1) or return 0;
+ $in->do_pkgs->ensure_binary_is_installed('grub', "grub", 1) or return 0;
}
bootloader::set_profiles($b, $profiles);
diff --git a/perl-install/diskdrake/dav.pm b/perl-install/diskdrake/dav.pm
index 51b6699a1..7481cb631 100644
--- a/perl-install/diskdrake/dav.pm
+++ b/perl-install/diskdrake/dav.pm
@@ -11,7 +11,7 @@ sub main {
my ($in, $all_hds) = @_;
my $davs = $all_hds->{davs};
- $in->do_pkgs->ensure_is_installed('davfs', '/sbin/mount.davfs') or return;
+ $in->do_pkgs->ensure_binary_is_installed('davfs', 'mount.davfs') or return;
my $quit;
do {
diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm
index 005e61c9a..f0feda785 100644
--- a/perl-install/do_pkgs.pm
+++ b/perl-install/do_pkgs.pm
@@ -24,6 +24,21 @@ sub ensure_is_installed {
1;
}
+sub ensure_binary_is_installed {
+ my ($do, $pkg, $binary, $b_auto) = @_;
+
+ 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 (!whereis_binary($binary, $::prefix)) {
+ $do->in->ask_warn('', N("Mandatory package %s is missing", $pkg));
+ return;
+ }
+ 1;
+}
+
sub ensure_is_installed_if_available {
my ($do, $pkg, $file) = @_;
if (! -e "$::prefix$file" && !$::testing) {
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
index 438d4b8b0..a13608201 100644
--- a/perl-install/harddrake/sound.pm
+++ b/perl-install/harddrake/sound.pm
@@ -161,7 +161,7 @@ sub do_switch {
$modules_conf->set_sound_slot("sound-slot-$index", $new_driver);
$modules_conf->write;
if ($new_driver =~ /^snd-/) { # new driver is an alsa one
- $in->do_pkgs->ensure_is_installed('alsa-utils', '/usr/sbin/alsactl');
+ $in->do_pkgs->ensure_binary_is_installed('alsa-utils', 'alsactl');
rooted("service alsa start") if $::isStandalone && !$blacklisted;
rooted("/sbin/chkconfig --add alsa") if $::isStandalone;
load($modules_conf, $new_driver) if $::isStandalone; # service alsa is buggy
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index e63daa1ff..baf8e6f00 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -64,7 +64,7 @@ sub lvm_cmd_or_die {
sub check {
my ($in) = @_;
- $in->do_pkgs->ensure_is_installed('lvm2', '/sbin/lvm2') or return;
+ $in->do_pkgs->ensure_binary_is_installed('lvm2', 'lvm2') or return;
init();
1;
}
diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm
index 5ade3db27..6fe4a629c 100644
--- a/perl-install/network/drakfirewall.pm
+++ b/perl-install/network/drakfirewall.pm
@@ -130,7 +130,7 @@ sub set_ports {
my ($in, $disabled, $ports) = @_;
my $shorewall = network::shorewall::read($in, 'not_silent') || network::shorewall::default_interfaces($in) or die N("No network card");
if (!$disabled || -x "$::prefix/sbin/shorewall") {
- $in->do_pkgs->ensure_is_installed('shorewall', '/sbin/shorewall', $::isInstall) or return;
+ $in->do_pkgs->ensure_binary_is_installed('shorewall', 'shorewall', $::isInstall) or return;
$shorewall->{disabled} = $disabled;
$shorewall->{ports} = $$ports;
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index 1cfa15075..e08914a7e 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -634,7 +634,7 @@ killall pppd
post => sub {
network::modem::ppp_configure($in, $modem);
$netc->{$_} = 'ppp0' foreach 'NET_DEVICE', 'NET_INTERFACE';
- $in->do_pkgs->ensure_is_installed('kdenetwork-kppp', '/usr/bin/kppp');
+ $in->do_pkgs->ensure_binary_is_installed('kdenetwork-kppp', 'kppp');
$handle_multiple_cnx->();
},
},
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 1af6b6a44..06e86155c 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -410,7 +410,7 @@ sub configureNetwork2 {
my ($in, $_prefix, $netc, $intf) = @_;
my $etc = "$::prefix/etc";
if (!$::testing) {
- $netc->{wireless_eth} and $in->do_pkgs->ensure_is_installed('wireless-tools', '/sbin/iwconfig', 'auto');
+ $netc->{wireless_eth} and $in->do_pkgs->ensure_binary_is_installed('wireless-tools', 'iwconfig', 'auto');
write_conf("$etc/sysconfig/network", $netc);
write_resolv_conf("$etc/resolv.conf", $netc) if ! $netc->{DHCP};
write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_, $netc, $::prefix) foreach grep { $_->{DEVICE} ne 'ppp0' } values %$intf;
@@ -419,8 +419,8 @@ sub configureNetwork2 {
any { $_->{BOOTPROTO} eq "dhcp" } values %$intf and $in->do_pkgs->install($netc->{dhcp_client} || 'dhcp-client');
if ($netc->{ZEROCONF_HOSTNAME}) {
- $in->do_pkgs->ensure_is_installed('tmdns', '/sbin/tmdns', 'auto') if !$in->do_pkgs->is_installed('bind');
- $in->do_pkgs->ensure_is_installed('zcip', '/sbin/zcip', 'auto');
+ $in->do_pkgs->ensure_binary_is_installed('tmdns', 'tmdns', 'auto') if !$in->do_pkgs->is_installed('bind');
+ $in->do_pkgs->ensure_binary_is_installed('zcip', 'zcip', 'auto');
write_zeroconf("$etc/tmdns.conf", $netc->{ZEROCONF_HOSTNAME});
} else { run_program::rooted($::prefix, "chkconfig", "--del", $_) foreach qw(tmdns zcip) } # disable zeroconf
any { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } values %$intf and $in->do_pkgs->install('pump');
diff --git a/perl-install/network/nfs.pm b/perl-install/network/nfs.pm
index 39faa716e..37dd954e5 100644
--- a/perl-install/network/nfs.pm
+++ b/perl-install/network/nfs.pm
@@ -29,7 +29,7 @@ sub to_dev_raw {
sub check {
my ($_class, $in) = @_;
- $in->do_pkgs->ensure_is_installed('nfs-utils-clients', '/usr/sbin/showmount') or return;
+ $in->do_pkgs->ensure_binary_is_installed('nfs-utils-clients', 'showmount') or return;
system('/etc/init.d/portmap start') if system('/etc/init.d/portmap status') != 0;
1;
}
diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm
index 2deeb9507..26b61c518 100644
--- a/perl-install/network/smb.pm
+++ b/perl-install/network/smb.pm
@@ -32,7 +32,7 @@ sub to_dev_raw {
sub check {
my ($_class, $in) = @_;
- $in->do_pkgs->ensure_is_installed('samba-client', '/usr/bin/nmblookup');
+ $in->do_pkgs->ensure_binary_is_installed('samba-client', 'nmblookup');
}
sub smbclient {
diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups
index 9ebadc838..a3027d098 100755
--- a/perl-install/standalone/drakups
+++ b/perl-install/standalone/drakups
@@ -380,6 +380,6 @@ foreach my $i (@pages) {
#------------------------------------------------------------------
# let's start the show:
-$in->do_pkgs->ensure_is_installed('nut-server', '/usr/sbin/upsd') if !$::testing;
+$in->do_pkgs->ensure_binary_is_installed('nut-server', 'upsd') if !$::testing;
$w->{rwindow}->show_all;
$w->main;
diff --git a/perl-install/standalone/drakxtv b/perl-install/standalone/drakxtv
index 40e78fb09..b57547113 100755
--- a/perl-install/standalone/drakxtv
+++ b/perl-install/standalone/drakxtv
@@ -35,7 +35,7 @@ sub scan4channels() {
# xawtv has been installed by DrakX when/if it's detected a tv
# card.
- $in->do_pkgs->ensure_is_installed('xawtv', '/usr/bin/scantv');
+ $in->do_pkgs->ensure_binary_is_installed('xawtv', 'scantv');
my ($ftable_id, $norm);
# this table must be checked on each xawtv release: