summaryrefslogtreecommitdiffstats
path: root/autoirpm.uninstall
blob: d0483a0340c1264bbb40f786497fa1ca57790139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl

$DIR = "/etc/urpmi";
$BASE = "$DIR/autoirpm";
$AUTO_INSTALL_BIN_LIST = "$BASE.binaries";
$INSTALL_SCRIPT_REP = "$BASE.scripts";

open F, $AUTO_INSTALL_BIN_LIST or die;
map { chop; remove_links_and_scripts($_) } <F>;
close F;

sub remove_links_and_scripts($) {
    my ($rpm, @progs) = split;

    my $script = "$INSTALL_SCRIPT_REP/$rpm";

    -e $script or return 0; # not installed for this package
    foreach (<@progs>) { 
	readlink "/$_" ne $script and next;
	unlink "/$_" or warn "removing $_ failed";
    }
    unlink $script or warn "removing $script failed";
}