1 |
sashby |
1.6 |
#!/usr/bin/env perl
|
2 |
sashby |
1.5 |
###############################################################
|
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 |
williamc |
1.4 |
|
15 |
sashby |
1.7 |
# Using "env" and exec doesn't work.
|
16 |
|
|
# This can be overridden (hard-coded) using the -perl option
|
17 |
sashby |
1.8 |
my $perl="/usr/bin/env perl";
|
18 |
williamc |
1.4 |
|
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 |
williamc |
1.1 |
use Cwd;
|
32 |
|
|
$thisdir=cwd();
|
33 |
|
|
(($basedir=$thisdir)=~s/(.*)\/.*/\1/);
|
34 |
|
|
($topdir=$basedir)=~s/(.*)\/.*/\1/;
|
35 |
|
|
|
36 |
williamc |
1.3 |
# Create the directory for storing databases
|
37 |
|
|
use File::Path;
|
38 |
|
|
mkpath("$topdir/scramdb", 0, 0755);
|
39 |
|
|
|
40 |
sashby |
1.9 |
# Get SITE name from user:
|
41 |
|
|
print "** Please enter the name of your SITE (e.g. CERN[default], FNAL) **","\n";
|
42 |
sashby |
1.10 |
print "sitename?: ";
|
43 |
sashby |
1.9 |
chomp($scramsite=<STDIN>);
|
44 |
|
|
if ($scramsite eq '') {$scramsite='CERN'};
|
45 |
|
|
print "\n";
|
46 |
|
|
|
47 |
sashby |
1.10 |
# 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 |
sashby |
1.9 |
# Copy the wrapper file with the correct base variable installed:
|
55 |
williamc |
1.1 |
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 |
williamc |
1.4 |
$_=~s/__perlexe__/$perl/g;
|
60 |
sashby |
1.9 |
$_=~s/__scramsite__/$scramsite/g;
|
61 |
sashby |
1.10 |
$_=~s/__loccmstools__/$loccmstools/g;
|
62 |
williamc |
1.1 |
print OUTFILE $_;
|
63 |
|
|
}
|
64 |
williamc |
1.2 |
chmod 0755, "$topdir/scram";
|
65 |
williamc |
1.1 |
close WRAP;
|
66 |
sashby |
1.9 |
|
67 |
|
|
print "SCRAM executable is $topdir/scram","\n";
|