diff options
author | Ben Summers <ben@fluffy.co.uk> | 2005-10-14 08:50:54 +0000 |
---|---|---|
committer | Ben Summers <ben@fluffy.co.uk> | 2005-10-14 08:50:54 +0000 |
commit | 99f8ce096bc5569adbfea1911dbcda24c28d8d8b (patch) | |
tree | 049c302161fea1f2f6223e1e8f3c40d9e8aadc8b /infrastructure/setupexternal.pl |
Box Backup 0.09 with a few tweeks
Diffstat (limited to 'infrastructure/setupexternal.pl')
-rwxr-xr-x | infrastructure/setupexternal.pl | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/infrastructure/setupexternal.pl b/infrastructure/setupexternal.pl new file mode 100755 index 00000000..e21403e1 --- /dev/null +++ b/infrastructure/setupexternal.pl @@ -0,0 +1,55 @@ +#!/usr/bin/perl +use strict; + +# This script links in the essential directories and processes various +# files to allow the Box libraries to be used in projects outside the main +# box library tree. + +# directories to link through +my @linkdirs = qw/lib infrastructure/; + +# ---------------------------------------------------- + +my $libdir = $ARGV[0]; +die "Provided library dir $libdir does not exist" unless -d $libdir; + +# Check and remove links from the directory, then add new symlinks +for my $d (@linkdirs) +{ + if(-e $d) + { + die "In project, $d is not a symbolic link" + unless -l $d; + print "Removing existing symlink $d\n"; + unlink $d; + } + my $link_target = "$libdir/$d"; + print "Add symlink $d -> $link_target\n"; + die "Can't create symlink $d" unless + symlink $link_target, $d; +} + +# Copy and create a base modules file which includes all the libraries +print "Create new modules_base.txt file\n"; +open OUT,">modules_base.txt" or die "Can't open modules_base.txt file for writing"; +print OUT <<__E; +# +# Automatically generated file, do not edit +# +# Source: $libdir/modules.txt +# + +__E + +open IN,"$libdir/modules.txt" or die "Can't open $libdir/modules.txt for reading"; + +while(<IN>) +{ + if(m/\A(lib\/.+?)\s/) + { + print OUT + } +} + +close IN; +close OUT; |