9 |
|
$normal = "\033[0m"; |
10 |
|
@allowed_commands=qw(project build install version list arch setup); |
11 |
|
|
12 |
< |
foreach $command ( @allowed_commands ) { |
13 |
< |
if ( $inputcmd=~/^$command\Z/i) { |
12 |
> |
if ( $inputcmd ne "" ) { |
13 |
> |
foreach $command ( @allowed_commands ) { |
14 |
> |
if ( $command=~/^$inputcmd/i) { |
15 |
|
# Deal with a help request |
16 |
|
do{ helpheader($command); |
17 |
|
&{"help_".$command}; exit; } if $ARGV[0]=~/help/i; |
18 |
|
&$command; $found='true'; |
19 |
|
last; |
20 |
|
} |
21 |
+ |
} |
22 |
|
} |
23 |
|
|
24 |
|
if ( ! ( $found=~/true/ ) ) { |
57 |
|
use File::Copy; |
58 |
|
use Utilities::AddDir; |
59 |
|
|
60 |
+ |
&localtop; |
61 |
+ |
chdir $ENV{LOCALTOP}; |
62 |
|
use BootStrapProject; |
63 |
|
# get the bootstrap files downloaded |
64 |
|
BootStrapProject("$project\?\?$version"); |
65 |
|
# Go setup the rest of the environement, now we can |
62 |
– |
chdir $ENV{LOCALTOP}; |
63 |
– |
&localtop; |
66 |
|
LoadEnvFile(); |
67 |
|
# |
68 |
|
# Now create the directories specified in the interface |
79 |
|
use clientfile; |
80 |
|
BuildClientFile( $ENV{SCRAM_ProjReqsDoc} ); |
81 |
|
use Cwd; |
82 |
< |
print "Installation Located at:\n".cwd()."\n"; |
82 |
> |
print "\nInstallation Procedure Complete. \n". |
83 |
> |
"Installation Located at:\n".cwd()."\n"; |
84 |
|
} |
85 |
|
|
86 |
|
sub FullEnvInit { |
134 |
|
exit 1; |
135 |
|
} |
136 |
|
} #end block |
137 |
< |
($ENV{THISDIR}=cwd)=~s/^$ENV{LOCALTOP}//; |
137 |
> |
($ENV{THISDIR}=cwd)=~s/^\Q$ENV{LOCALTOP}\L//; |
138 |
|
$ENV{THISDIR}=~s/^\///; |
139 |
|
$ENV{SCRAM_WORKDIR}="$ENV{LOCALTOP}/.SCRAM"; |
140 |
|
} |
271 |
|
$ENV{SCRAM_BootStrapFiles}="$ENV{LOCALTOP}/.SCRAM:". |
272 |
|
$ENV{SCRAM_BootStrapFiles}; |
273 |
|
} |
274 |
< |
# Check for the correct toolfile |
275 |
< |
# ideally try and download it if not already in .SCRAM |
276 |
< |
# Only scram toolbox files supported so far |
277 |
< |
if ( ! -e "$ENV{LOCALTOP}/.SCRAM/$toolname" ) { |
274 |
> |
# If no toolname specified then its a full setup |
275 |
> |
if ( $toolname eq "" ) { |
276 |
> |
my $filebase="$ENV{LOCALTOP}/.SCRAM/$ENV{SCRAM_ARCH}"; |
277 |
> |
rename "$filebase/clientsettings", "$filebase/clientsettings.old"; |
278 |
> |
rename "$filebase/clientsettings_reqs", |
279 |
> |
"$filebase/clientsettings_reqs.old"; |
280 |
> |
use clientfile; |
281 |
> |
BuildClientFile( $ENV{SCRAM_ProjReqsDoc} ); |
282 |
> |
} |
283 |
> |
else { |
284 |
> |
# Check for the correct toolfile |
285 |
> |
# ideally try and download it if not already in .SCRAM |
286 |
> |
# Only scram toolbox files supported so far |
287 |
> |
if ( ! -e "$ENV{LOCALTOP}/.SCRAM/$toolname" ) { |
288 |
|
&urlhandler::urlhandler("file:$ENV{SCRAM_HOME}/toolbox/" |
289 |
|
.$toolname, "$ENV{LOCALTOP}/.SCRAM/$toolname") ; |
290 |
+ |
} |
291 |
+ |
# Parse the toolfile and update the clientsettings file |
292 |
+ |
# currently just append to the end |
293 |
+ |
use clientfile; |
294 |
+ |
clientfile::openclientfile('add'); |
295 |
+ |
clientfile::_tool("file:$toolname"); |
296 |
+ |
closeclientfile; |
297 |
|
} |
278 |
– |
# Parse the toolfile and update the clientsettings file |
279 |
– |
# currently just append to the end |
280 |
– |
use clientfile; |
281 |
– |
clientfile::openclientfile('add'); |
282 |
– |
clientfile::_tool("file:$toolname"); |
283 |
– |
closeclientfile; |
298 |
|
} |
299 |
|
|
300 |
|
sub help_setup { |
301 |
|
|
302 |
|
print <<ENDTEXT; |
303 |
|
Allows installation of a new tool/external package into an already |
304 |
< |
existing area. |
304 |
> |
existing area. If not toolname is specified, the complete installation |
305 |
> |
process is initiated. |
306 |
|
|
307 |
|
Usage: |
308 |
|
|
309 |
< |
$bold scram setup $normal toolname |
309 |
> |
$bold scram setup $normal [toolname] |
310 |
|
|
311 |
|
toolname : The name of the tool setup file required. |
312 |
|
ENDTEXT |