blob: 7be979ea1ee495d343ad985cfae2ad12ad17fd16 (
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
|
#!/usr/bin/perl
$DIR = "/var/lib/urpmi";
$DIR2 = "/etc/urpmi";
$BASE = "$DIR/autoirpm";
$BASE2 = "$DIR2/autoirpm";
$AUTO_INSTALL_BIN_LIST = "$BASE.binaries";
$INSTALL_SCRIPT_REP = "$BASE.scripts";
system("gzip -dc $DIR/hdlist.*.gz | autoirpm.update-all $BASE2.allow $BASE2.deny - > $AUTO_INSTALL_BIN_LIST");
$? == 0 or die "autoirpm.upgrade-all failed\n";
open F, $AUTO_INSTALL_BIN_LIST or die;
map { chop; create_links_and_install_scripts($_) } <F>;
close F;
sub create_links_and_install_scripts($) {
my ($rpm, @progs) = split ' ', $_[0];
my $script = "$INSTALL_SCRIPT_REP/$rpm";
foreach (@progs) { lstat "/$_" and return } # verify that it's not installed
foreach (@progs) {
make_dirname("/$_");
symlink $script, "/$_"; # or die "$rpm: /$_";
}
open G, ">$script" or die;
print G "_irpm $rpm \$0 \$*\n";
close G;
chmod 0755, "$script";
}
sub make_dirname($) {
my $file = $_[0];
my $dir = `dirname $file`;
`mkdir -p $dir 2>/dev/null`;
}
|