blob: ffa45c9d4be577e671ee722ef7c9c1217c273df5 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use List::MoreUtils 'uniq';
# Set the environment for the FixMyStreet project
# Add the lii/perl5 in perl-external so that we can load local::lib from there
use lib "$FindBin::Bin/perl-external/lib/perl5";
# Add the perl-external dirs properly using local::lib
use local::lib "$FindBin::Bin/perl-external";
use local::lib "$FindBin::Bin/perl-external/local-lib";
# add the local perllibs too
use lib "$FindBin::Bin/commonlib/perllib";
use lib "$FindBin::Bin/perllib";
# also set the path to our scripts etc
$ENV{PATH} = join ':', uniq "$FindBin::Bin/bin", split( m/:/, $ENV{PATH} );
# now decide what to do - if no arguments print out shell arguments to set the
# environment. If there are arguments then run those so that they run correctly
if (@ARGV) {
system @ARGV;
}
else {
my @keys = sort 'PATH', grep { m{^PERL} } keys %ENV;
print "export $_='$ENV{$_}'\n" for @keys;
print 'export PS1="(fms) $PS1"' . "\n";
print << "STOP";
# $0 - set up the environment for FixMyStreet.
#
# This script can be used one of two ways:
#
# With arguments executes the arguments with the environment correctly set -
# intended for things like the cron jobs:
#
# $0 env
#
# Or if no arguments prints out the bash shell commands needed to set up the
# environment - which is useful when developing. Use this to set your current
# shell:
#
# eval `$0`
STOP
}
|