ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/bin/scram
(Generate patch)

Comparing COMP/SCRAM/bin/scram (file contents):
Revision 1.1.2.3 by muzaffar, Thu Feb 28 16:14:37 2008 UTC vs.
Revision 1.7 by muzaffar, Thu Mar 14 10:42:00 2013 UTC

# Line 15 | Line 15 | BEGIN
15     unshift @INC,"$installdir", "${installdir}/src";
16     }
17  
18 use SCRAM::SCRAM_SITE;
18   use SCRAM::SCRAM;
19   use Getopt::Long ();
20  
21   #### EDIT THESE: SCRAM Installation Values #################
22   $ENV{'SCRAM_VERSION'}='@SCRAM_VERSION@';
23 < $ENV{'SCRAM_LOOKUPDB'}='@SCRAM_LOOKUPDB_DIR@/project.lookup';
24 < ################################################
26 < if (exists $ENV{SCRAM_USERLOOKUPDB} && -f "$ENV{SCRAM_USERLOOKUPDB}")
27 <   {
28 <   $ENV{'SCRAM_LOOKUPDB'}=$ENV{SCRAM_USERLOOKUPDB};
29 <   print "Using $ENV{SCRAM_USERLOOKUPDB} as the database.","\n", if ($ENV{SCRAM_DEBUG});
30 <   }
23 > my $dbPath = '@CMS_PATH@';
24 > my $dbPathWrite = '@CMS_PATH@';
25   #### Core settings ####
26   $main::bold = "";
27   $main::normal = "";
# Line 37 | Line 31 | $main::error = "";
31   $main::good = "";
32   $main::prompt="";
33   $main::ORIG_ARGV=[];
34 + $main::ORIG_SCRAM_ARCH = $ENV{SCRAM_ARCH} || "";
35 + $main::FORCE_SCRAM_ARCH = "";
36   push @$main::ORIG_ARGV,@ARGV;
37 + $|=1;
38 +
39 + if (!exists $ENV{SCRAM_LOOKUPDB})
40 +   {
41 +   if (exists $ENV{SCRAM_USERLOOKUPDB})
42 +      {
43 +      $dbPath = $ENV{SCRAM_USERLOOKUPDB};
44 +      $dbPathWrite = $dbPath;
45 +      }
46 +   $ENV{SCRAM_LOOKUPDB} = $dbPath;
47 +   }
48 + if (!exists $ENV{SCRAM_LOOKUPDB_WRITE})
49 +   {
50 +   if (exists $ENV{SCRAM_USERLOOKUPDB}){$dbPathWrite = $ENV{SCRAM_USERLOOKUPDB};}
51 +   $ENV{SCRAM_LOOKUPDB_WRITE} = $dbPathWrite;
52 +   }
53  
54   # Test whether the output from SCRAM is being redirected, or
55   # not (prevents escape signals from being printed to STDOUT if
# Line 59 | Line 71 | $scram = SCRAM::SCRAM->new();
71   # Getopt option variables:
72   my %opts;
73   my %options =
74 <   ("verbose\v=s"               => sub { $ENV{SCRAM_VERBOSE} = $ENV{SCRAM_DEBUG} = 1; $scram->classverbosity($_[1]) },
74 >   ("verbose|v=s"       => sub { $ENV{SCRAM_VERBOSE} = $ENV{SCRAM_DEBUG} = 1; $scram->classverbosity($_[1]) },
75      "debug|d"           => sub { $ENV{SCRAM_DEBUG} = 1; $scram->fullverbosity() },
76 <    "arch|a=s"          => sub { $ENV{SCRAM_ARCH} = $_[1]; $scram->architecture($ENV{SCRAM_ARCH}) },
77 <    "noreturn|n"          => sub { $opts{SCRAM_NORETURN} = 1 }, # Pause after returning (for download in NS)
78 <    "force|f"             => sub { $opts{SCRAM_FORCE} = 1 }, # A force flag for commands that might need it
67 <    "help|h"            => sub { $opts{SCRAM_HELP} = 1 }
76 >    "arch|a=s"          => sub { $ENV{SCRAM_ARCH} = $_[1] ; $main::FORCE_SCRAM_ARCH = $_[1] },
77 >    "force|f"           => sub { $opts{SCRAM_FORCE} = 1 }, # A force flag for commands that might need it
78 >    "help|h"            => sub { print $scram->usage(); exit(0) ;}
79      );
80  
81   # Get the options using Getopt:
# Line 79 | Line 90 | if (! Getopt::Long::GetOptions(\%opts, %
90   # Check for a valid command and execute it or show an error message:
91   my $command=shift(@ARGV);
92  
93 < # Handle help option:
83 < if ($opts{SCRAM_HELP} || ! $command)
93 > if (!$command)
94     {
95     print $scram->usage();
96 <   exit(0);
87 <   }
88 <
89 < # Now execute the desired command (the routine automatically
90 < # checks to make sure the command is valid):
91 < my $retval = $scram->execcommand($command,@ARGV);
92 <
93 < # Check to see if we have --noreturn set. If so, we may be running
94 < # as a helper application in a web browser:
95 < if ($opts{SCRAM_NORETURN})
96 <   {
97 <   print "\n";
98 <   my $dummy = <STDIN>;
96 >   exit(1);
97     }
98 + elsif($command=~/^(install|remove)$/o){exit(0);}
99 + $scram->init ($opts{SCRAM_FORCE});
100  
101 < exit($retval);
102 < #### End of SCRAM script ####
101 > exit($scram->execcommand($command,@ARGV));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines