1 |
williamc |
1.1 |
#!/usr/local/bin/perl5
|
2 |
|
|
#
|
3 |
|
|
# SCRAM Installation Script
|
4 |
|
|
#
|
5 |
|
|
# To be run from the Installation directory
|
6 |
|
|
#
|
7 |
williamc |
1.4 |
# Usage :
|
8 |
|
|
# perl install_scram [-perl perlexecutable]
|
9 |
|
|
|
10 |
|
|
my $perl="/usr/local/bin/perl5"; # default - override with -perl option
|
11 |
|
|
|
12 |
|
|
# process options
|
13 |
|
|
while ( $ARGV[0]=~"^-" ) {
|
14 |
|
|
if ( $ARGV[0]=~/-perl/ ) {
|
15 |
|
|
shift @ARGV;
|
16 |
|
|
$perl=shift @ARGV;
|
17 |
|
|
next;
|
18 |
|
|
}
|
19 |
|
|
print "Unknown Option $ARGV[0]\n";
|
20 |
|
|
print "Usage : perl install_scram [-perl perlexecutable]\n";
|
21 |
|
|
exit 1;
|
22 |
|
|
}
|
23 |
|
|
|
24 |
williamc |
1.1 |
|
25 |
|
|
use Cwd;
|
26 |
|
|
$thisdir=cwd();
|
27 |
|
|
(($basedir=$thisdir)=~s/(.*)\/.*/\1/);
|
28 |
|
|
($topdir=$basedir)=~s/(.*)\/.*/\1/;
|
29 |
|
|
|
30 |
williamc |
1.3 |
# Create the directory for storing databases
|
31 |
|
|
use File::Path;
|
32 |
|
|
mkpath("$topdir/scramdb", 0, 0755);
|
33 |
|
|
|
34 |
williamc |
1.1 |
# Copy the wrapper file with the correct base variable installed
|
35 |
|
|
open ( WRAP , "<scramwrapper") or die "Unable to open scramwrapper $!";
|
36 |
|
|
open ( OUTFILE , ">$topdir/scram") or die "Unable to open $topdir/scram $!";
|
37 |
|
|
while ( <WRAP> ) {
|
38 |
|
|
$_=~s/__basedir__/$basedir/g;
|
39 |
williamc |
1.4 |
$_=~s/__perlexe__/$perl/g;
|
40 |
williamc |
1.1 |
print OUTFILE $_;
|
41 |
|
|
}
|
42 |
williamc |
1.2 |
chmod 0755, "$topdir/scram";
|
43 |
williamc |
1.1 |
close WRAP;
|