blob: d375caa7d3d0f5be27f9b5abdf3aa29d71c4af64 (
plain) (
blame)
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
57
58
|
#! /usr/bin/perl -w
use strict;
use Cwd;
my $selfdir = cwd;
my @dirs = ("bin", "sbin", "lib", "include");
# Create the subdirectories.
mkdir $selfdir;
foreach my $dir (@dirs) {
mkdir "$selfdir/$dir";
}
# For each activated package, create symlinks.
sub createLinks {
my $srcdir = shift;
my $dstdir = shift;
my @srcfiles = glob("$srcdir/*");
foreach my $srcfile (@srcfiles) {
my $basename = $srcfile;
$basename =~ s/^.*\///g; # strip directory
my $dstfile = "$dstdir/$basename";
if (-d $srcfile) {
# !!! hack for resolving name clashes
if (!-e $dstfile) {
mkdir($dstfile) or
die "error creating directory $dstfile";
}
-d $dstfile or die "$dstfile is not a directory";
createLinks($srcfile, $dstfile);
} elsif (-l $dstfile) {
my $target = readlink($dstfile);
die "collission between $srcfile and $target";
} else {
print "linking $dstfile to $srcfile\n";
symlink($srcfile, $dstfile) or
die "error creating link $dstfile";
}
}
}
foreach my $name (keys %ENV) {
next unless ($name =~ /^act.*$/);
my $pkgdir = $ENV{$name};
print "merging $pkgdir\n";
foreach my $dir (@dirs) {
createLinks("$pkgdir/$dir", "$selfdir/$dir");
}
}
|