1 |
williamc |
1.4 |
#!__perlexe__
|
2 |
sashby |
1.7 |
###############################################################
|
3 |
|
|
# scram #
|
4 |
|
|
###############################################################
|
5 |
|
|
# modified : Mon Nov 12 11:17:18 2001 / SFA #
|
6 |
|
|
# function : Wrap the main scram program, set up any system #
|
7 |
|
|
# : variables required and process arguments. #
|
8 |
|
|
# : #
|
9 |
|
|
# : #
|
10 |
|
|
###############################################################
|
11 |
williamc |
1.1 |
|
12 |
sashby |
1.11 |
# Set the environment variable SCRAM here to avoid using "which":
|
13 |
|
|
$ENV{'SCRAM'}=$0;
|
14 |
|
|
|
15 |
williamc |
1.1 |
$re='false';
|
16 |
sashby |
1.7 |
my $ret;
|
17 |
williamc |
1.2 |
@args=@ARGV;
|
18 |
sashby |
1.7 |
|
19 |
|
|
for ( my $i=0; $i<=$#args; $i++ )
|
20 |
|
|
{
|
21 |
|
|
if ( $args[$i] eq "-re" )
|
22 |
|
|
{
|
23 |
|
|
# Always request a User Return to exit the program
|
24 |
|
|
$re="true";
|
25 |
|
|
# cut it out of argument list passed down
|
26 |
|
|
splice(@args,$i,1);
|
27 |
|
|
}
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
# Set the SCRAM_HOME environment variable to point
|
31 |
|
|
# to current version:
|
32 |
|
|
if ( $ENV{SCRAM_HOME} eq "" )
|
33 |
|
|
{
|
34 |
|
|
$ENV{SCRAM_HOME}="__basedir__";
|
35 |
williamc |
1.1 |
}
|
36 |
|
|
|
37 |
sashby |
1.7 |
# The perl executable is now found using env
|
38 |
|
|
# instead of being hard-coded (NOTE: this var is only
|
39 |
|
|
# used in $ENV{SCRAM_HOME}/src/basics.mk):
|
40 |
|
|
if ( $ENV{SCRAMPERL} eq "" )
|
41 |
|
|
{
|
42 |
|
|
$ENV{SCRAMPERL}="__perlexe__"; # This should be changed if a hard-coded path
|
43 |
|
|
# to Perl5 is required in the buildsystem
|
44 |
|
|
}
|
45 |
williamc |
1.4 |
|
46 |
sashby |
1.7 |
# Set the path to local modules:
|
47 |
sashby |
1.8 |
$ENV{PERL5LIB}=join(":", "$ENV{SCRAM_HOME}/src", split(":", $ENV{PERL5LIB}));
|
48 |
sashby |
1.7 |
|
49 |
sashby |
1.10 |
# Set shell variables to control scram behaviour:
|
50 |
sashby |
1.12 |
$ENV{'SITENAME'}='__scramsite__' if ( ! $ENV{'SITENAME'});
|
51 |
sashby |
1.10 |
# This variable overrides the reading of project areas
|
52 |
|
|
# for tool settings during scram setup/scram project:
|
53 |
|
|
$ENV{'SEARCHOVRD'}='true' if ( ! $ENV{'SEARCHOVRD'});
|
54 |
sashby |
1.13 |
# Default location for cmstools file:
|
55 |
sashby |
1.14 |
$ENV{'LOCCMSTOOLS'}='__loccmstools__' if ( ! $ENV{'LOCCMSTOOLS'});
|
56 |
sashby |
1.10 |
|
57 |
sashby |
1.7 |
# Execute scramcli with args:
|
58 |
|
|
if ( -e "$ENV{SCRAM_HOME}/src/scramcli" )
|
59 |
|
|
{
|
60 |
sashby |
1.9 |
exec { "/usr/bin/env" } "/usr/bin/env", "perl", "$ENV{SCRAM_HOME}/src/scramcli", @args;
|
61 |
sashby |
1.8 |
die "Problems executing scram: $!","\n";
|
62 |
sashby |
1.7 |
}
|
63 |
|
|
else
|
64 |
|
|
# For older versions:
|
65 |
|
|
{
|
66 |
sashby |
1.10 |
exec { "/usr/bin/env" } "/usr/bin/env", "perl", "$ENV{SCRAM_HOME}/src/scram", @args;
|
67 |
|
|
die "Problems executing scram: $!","\n";
|
68 |
sashby |
1.7 |
}
|
69 |
|
|
|
70 |
|
|
# Prompt for a carriage return if
|
71 |
|
|
# the -re option was set:
|
72 |
|
|
if ( $re eq 'true' )
|
73 |
|
|
{
|
74 |
|
|
print "\nPress RETURN to exit\n";
|
75 |
|
|
$junk=<STDIN>;
|
76 |
|
|
}
|
77 |
|
|
|
78 |
sashby |
1.8 |
# Return an exit status:
|
79 |
williamc |
1.3 |
exit $ret/256;
|