2003-03-25 17:36:25 +01:00
|
|
|
#! /usr/bin/perl -w
|
|
|
|
|
|
|
|
use strict;
|
2003-04-09 14:26:48 +02:00
|
|
|
use Cwd;
|
2003-03-25 17:36:25 +01:00
|
|
|
|
2003-04-09 14:26:48 +02:00
|
|
|
my $selfdir = cwd;
|
2003-03-25 17:36:25 +01:00
|
|
|
|
2003-04-09 14:26:48 +02:00
|
|
|
my @dirs = ("bin", "sbin", "lib", "include");
|
2003-03-25 17:36:25 +01:00
|
|
|
|
|
|
|
# Create the subdirectories.
|
2003-04-09 14:26:48 +02:00
|
|
|
mkdir $selfdir;
|
2003-03-25 17:36:25 +01:00
|
|
|
foreach my $dir (@dirs) {
|
2003-04-09 14:26:48 +02:00
|
|
|
mkdir "$selfdir/$dir";
|
2003-03-25 17:36:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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);
|
2003-03-28 17:27:23 +01:00
|
|
|
} elsif (-l $dstfile) {
|
|
|
|
my $target = readlink($dstfile);
|
|
|
|
die "collission between $srcfile and $target";
|
2003-03-25 17:36:25 +01:00
|
|
|
} else {
|
|
|
|
print "linking $dstfile to $srcfile\n";
|
|
|
|
symlink($srcfile, $dstfile) or
|
|
|
|
die "error creating link $dstfile";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-09 14:26:48 +02:00
|
|
|
foreach my $name (keys %ENV) {
|
2003-03-25 17:36:25 +01:00
|
|
|
|
2003-04-09 14:26:48 +02:00
|
|
|
next unless ($name =~ /^act.*$/);
|
2003-03-25 17:36:25 +01:00
|
|
|
|
2003-04-09 14:26:48 +02:00
|
|
|
my $pkgdir = $ENV{$name};
|
2003-03-25 17:36:25 +01:00
|
|
|
|
|
|
|
print "merging $pkgdir\n";
|
|
|
|
|
|
|
|
foreach my $dir (@dirs) {
|
2003-04-09 14:26:48 +02:00
|
|
|
createLinks("$pkgdir/$dir", "$selfdir/$dir");
|
2003-03-25 17:36:25 +01:00
|
|
|
}
|
|
|
|
}
|