1 |
#!/usr/bin/env perl
|
2 |
###############################################################
|
3 |
# install_scram #
|
4 |
###############################################################
|
5 |
# modified : Mon Nov 12 11:41:54 2001 / SFA #
|
6 |
# : #
|
7 |
# function : Installation script (to be run from Installation #
|
8 |
# : directory) #
|
9 |
# : #
|
10 |
# : Usage: #
|
11 |
# : perl install_scram [-perl perlexecutable] #
|
12 |
# : #
|
13 |
###############################################################
|
14 |
|
15 |
# Using "env" and exec doesn't work.
|
16 |
# This can be overridden (hard-coded) using the -perl option
|
17 |
my $perl="/usr/bin/env perl";
|
18 |
|
19 |
# process options
|
20 |
while ( $ARGV[0]=~"^-" ) {
|
21 |
if ( $ARGV[0]=~/-perl/ ) {
|
22 |
shift @ARGV;
|
23 |
$perl=shift @ARGV;
|
24 |
next;
|
25 |
}
|
26 |
print "Unknown Option $ARGV[0]\n";
|
27 |
print "Usage : perl install_scram [-perl perlexecutable]\n";
|
28 |
exit 1;
|
29 |
}
|
30 |
|
31 |
use Cwd;
|
32 |
$thisdir=cwd();
|
33 |
(($basedir=$thisdir)=~s/(.*)\/.*/\1/);
|
34 |
($topdir=$basedir)=~s/(.*)\/.*/\1/;
|
35 |
|
36 |
# Create the directory for storing databases
|
37 |
use File::Path;
|
38 |
mkpath("$topdir/scramdb", 0, 0755);
|
39 |
|
40 |
# Get SITE name from user:
|
41 |
print "** Please enter the name of your SITE (e.g. CERN[default], FNAL) **","\n";
|
42 |
print "sitename?: ";
|
43 |
chomp($scramsite=<STDIN>);
|
44 |
if ($scramsite eq '') {$scramsite='CERN'};
|
45 |
print "\n";
|
46 |
|
47 |
# Get SITE name from user:
|
48 |
print "** Please enter the default location of the cmstools file **","\n";
|
49 |
print "cmstools-".$scramsite.".conf location?: ";
|
50 |
chomp($loccmstools=<STDIN>);
|
51 |
if ($loccmstools eq '') {$loccmstools='NODEFAULT'};
|
52 |
print "\n";
|
53 |
|
54 |
# Copy the wrapper file with the correct base variable installed:
|
55 |
open ( WRAP , "<scramwrapper") or die "Unable to open scramwrapper $!";
|
56 |
open ( OUTFILE , ">$topdir/scram") or die "Unable to open $topdir/scram $!";
|
57 |
while ( <WRAP> ) {
|
58 |
$_=~s/__basedir__/$basedir/g;
|
59 |
$_=~s/__perlexe__/$perl/g;
|
60 |
$_=~s/__scramsite__/$scramsite/g;
|
61 |
$_=~s/__loccmstools__/$loccmstools/g;
|
62 |
print OUTFILE $_;
|
63 |
}
|
64 |
chmod 0755, "$topdir/scram";
|
65 |
close WRAP;
|
66 |
|
67 |
print "SCRAM executable is $topdir/scram","\n";
|