ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/scripts/cms-scram-install.pl
Revision: 1.2
Committed: Thu Jan 24 16:14:50 2002 UTC (23 years, 3 months ago) by sashby
Content type: application/x-perl
Branch: MAIN
CVS Tags: V0_19_6, V0_19_6p1, V0_19_5, SFATEST, V0_19_4, V0_19_4_pre3, V0_19_4_pre2, V0_19_4_pre1, V0_19_3
Branch point for: V0_19_4_B
Changes since 1.1: +7 -5 lines
Log Message:
Changes to error reporting.

File Contents

# User Rev Content
1 sashby 1.1 #!/usr/bin/env perl
2     #===========================================================================#
3     # NAME: cms-scram-install.pl #
4     #===========================================================================#
5     # #
6     # DATE: Wed Jan 23 16:02:38 2002 #
7     # #
8     # AUTHOR: Shaun Ashby #
9     # #
10     # MOD LOG: #
11     # #
12     # #
13     #===========================================================================#
14     # DESCRIPTION: A simple script to install and set links for a new #
15     # version of scram #
16     #===========================================================================#
17    
18     use strict;
19    
20     # Some local configuration stuff:
21     #my $CMSRELDIR="/afs/cern.ch/cms/Releases/";
22     my $CMSRELDIR="$ENV{HOME}/w1/work/CMS/Projects/";
23     # Check for an argument (a version to install):
24     my $VERSIONTOINSTALL=shift;
25     chomp($VERSIONTOINSTALL);
26    
27     do
28     {
29     &usage();
30     exit (1);
31     } if (! defined $VERSIONTOINSTALL);
32    
33     ##################################################################
34    
35 sashby 1.2 print "Dir: ",$CMSRELDIR."SCRAM/","\n";
36 sashby 1.1
37 sashby 1.2 if ( -d $CMSRELDIR."SCRAM/".$VERSIONTOINSTALL)
38 sashby 1.1 {
39 sashby 1.2 chdir($CMSRELDIR."SCRAM/");
40 sashby 1.1 # OK, so this version exists (has been checked out of the repository):
41 sashby 1.2 if ( -l $CMSRELDIR."SCRAM/current" )
42 sashby 1.1 {
43     print "Updating link \"current\" for SCRAM version $VERSIONTOINSTALL","\n";
44 sashby 1.2 system("rm -f ".$CMSRELDIR."SCRAM/current","ln -s $VERSIONTOINSTALL current");
45 sashby 1.1 }
46 sashby 1.2 if ( -l $CMSRELDIR."SCRAM/recommended" )
47 sashby 1.1 {
48     print "Updating link \"recommended\" for SCRAM version $VERSIONTOINSTALL","\n";
49 sashby 1.2 system("rm -f recommended","ln -s $VERSIONTOINSTALL recommended");
50 sashby 1.1 }
51     }
52     else
53     {
54     die "The SCRAM version $VERSIONTOINSTALL could not be found.","\n";
55     }
56    
57     print "Done","\n";
58    
59    
60    
61     sub usage
62     {
63     ###############################################################
64     # usage #
65     ###############################################################
66     # modified : Wed Jan 23 16:07:58 2002 / SFA #
67     # params : #
68     # : #
69     # : #
70     # : #
71     # function : Print a usage message then exit #
72     # : #
73     # : #
74     # : #
75     ###############################################################
76     print <<EOFUSAGE;
77     No argument given.
78     Usage:
79    
80     cms-scram-install.pl <VERSIONTOINSTALL>
81    
82     EOFUSAGE
83     }