diff options
-rw-r--r-- | perl-install/standalone.pm | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm index b74253f72..408088b33 100644 --- a/perl-install/standalone.pm +++ b/perl-install/standalone.pm @@ -10,11 +10,34 @@ c::setlocale(); c::bindtextdomain('libDrakX', "/usr/share/locale"); -sub pkgs_install { - my ($in, @l) = @_; - $in->suspend; - my $ret = system('urpmi --auto --best-output ' . join(' ', @l)); - $in->resume; + +package interactive_pkgs; + +sub interactive::do_pkgs { + my ($in) = @_; + bless { in => $in }, 'interactive_pkgs'; +} + +sub install { + my ($o, @l) = @_; + $o->{in}->suspend; + my $ret = system('urpmi', '--auto', '--best-output', @l); + $o->{in}->resume; + $ret; +} + +sub install_if { + my ($o, $deps, @l) = @_; + my @deps = deref($deps); + system('rpm', '-q', @deps) == 0 or return; + install($o, @l); +} + +sub remove { + my ($o, @l) = @_; + $o->{in}->suspend; + my $ret = system('rpm', '-e ', @l); + $o->{in}->resume; $ret; } |