summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone.pm
blob: 112705f694bb23dc7024244866ad41d4a76aa6be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package standalone; # $Id$

use c;

$::isStandalone = 1;

$ENV{SHARE_PATH} ||= "/usr/share";

c::setlocale();
c::bindtextdomain('libDrakX', "/usr/share/locale");



################################################################################
package pkgs_interactive;

sub interactive::do_pkgs {
    my ($in) = @_;
    bless { in => $in }, 'pkgs_interactive';
}

sub install {
    my ($o, @l) = @_;
    $o->{in}->suspend;
    my $wait = $in->wait_message('', _("Installing packages..."));
    my $ret = system('urpmi', '--allow-medium-change', '--auto', '--best-output', @l) == 0;
    undef $wait;
    $o->{in}->resume;
    $ret;
}

sub is_installed {
    my ($o, @l) = @_;
    system('rpm', '-q', @l) == 0;
}

sub remove {
    my ($o, @l) = @_;
    $o->{in}->suspend;
    my $ret = system('rpm', '-e', @l) == 0;
    $o->{in}->resume;
    $ret;
}

sub remove_nodeps {
    my ($o, @l) = @_;
    $o->{in}->suspend;
    my $ret = system('rpm', '-e', '--nodeps', @l) == 0;
    $o->{in}->resume;
    $ret;
}
################################################################################

package standalone;

1;