2003-05-26 16:03:24 +02:00
|
|
|
#! /usr/bin/perl -w
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Cwd;
|
|
|
|
|
2003-06-18 19:17:33 +02:00
|
|
|
my $selfdir = $ENV{"out"};
|
|
|
|
mkdir "$selfdir", 0755 || die "error creating $selfdir";
|
2003-05-26 16:03:24 +02:00
|
|
|
|
|
|
|
# For each activated package, create symlinks.
|
|
|
|
|
|
|
|
sub createLinks {
|
|
|
|
my $srcdir = shift;
|
|
|
|
my $dstdir = shift;
|
|
|
|
|
|
|
|
my @srcfiles = glob("$srcdir/*");
|
|
|
|
|
|
|
|
foreach my $srcfile (@srcfiles) {
|
2003-05-30 13:49:43 +02:00
|
|
|
my $basename = $srcfile;
|
|
|
|
$basename =~ s/^.*\///g; # strip directory
|
|
|
|
my $dstfile = "$dstdir/$basename";
|
|
|
|
if (-d $srcfile) {
|
|
|
|
# !!! hack for resolving name clashes
|
|
|
|
if (!-e $dstfile) {
|
2003-06-18 19:17:33 +02:00
|
|
|
mkdir $dstfile, 0755 ||
|
2003-05-30 13:49:43 +02:00
|
|
|
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";
|
2003-06-18 19:17:33 +02:00
|
|
|
symlink($srcfile, $dstfile) ||
|
2003-05-30 13:49:43 +02:00
|
|
|
die "error creating link $dstfile";
|
|
|
|
}
|
2003-05-26 16:03:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach my $name (keys %ENV) {
|
|
|
|
|
|
|
|
next unless ($name =~ /^act.*$/);
|
|
|
|
|
|
|
|
my $pkgdir = $ENV{$name};
|
|
|
|
|
|
|
|
print "merging $pkgdir\n";
|
|
|
|
|
2003-06-03 15:03:06 +02:00
|
|
|
createLinks("$pkgdir", "$selfdir");
|
2003-05-26 16:03:24 +02:00
|
|
|
}
|