summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone.pm
blob: 408088b33ffd4f5d0c0ad5893eec98f78cfd27ed (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
package standalone; # $Id$

use c;

$::isStandalone = 1;

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

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



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;
}

1;