Remove autoconf system that I wasn't maintaining
[blerg.git] / scripts / write-environment-configs.pl
1 #!/usr/bin/perl
2 use Cwd qw/abs_path/;
3 use strict;
4
5 my $ENV_DIR = shift;
6 if (!defined $ENV_DIR) {
7     die "Please specify an environment directory to write configs into\n";
8 }
9 $ENV_DIR = abs_path($ENV_DIR);
10
11 # Shell
12 open C, '>', "$ENV_DIR/etc/env.sh";
13 print C <<EOD;
14 if [ -z "\$PATH" ]; then
15     PATH="$ENV_DIR/bin"
16 else
17     PATH="\$PATH:$ENV_DIR/bin"
18 fi
19 export PATH
20
21 if [ -z "\$PERL5LIB" ]; then
22     PERL5LIB="$ENV_DIR/lib/perl5"
23 else
24     PERL5LIB="\$PERL5LIB:$ENV_DIR/lib/perl5"
25 fi
26 export PERL5LIB
27
28 BLERG_PATH="$ENV_DIR/data"
29 export BLERG_PATH
30 EOD
31 close C;
32
33 # nginx FastCGI params
34 open C, '>', "$ENV_DIR/etc/nginx-fastcgi-vars.conf";
35 print C <<EOD;
36 fastcgi_param BLERG_PATH "$ENV_DIR/data";
37 fastcgi_param PERL5LIB "$ENV_DIR/lib/perl5";
38 EOD
39 close C;
40
41 # Apache SetEnv
42 open C, '>', "$ENV_DIR/etc/apache-setenv.conf";
43 print C <<EOD;
44 SetEnv BLERG_PATH "$ENV_DIR/data"
45 SetEnv PERL5LIB "$ENV_DIR/lib/perl5"
46 EOD
47 close C;