Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2270 - trunk/perfsonar-bundle

Subject: perfsonar development work

List archive

perfsonar: r2270 - trunk/perfsonar-bundle


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2270 - trunk/perfsonar-bundle
  • Date: Thu, 22 Mar 2007 09:14:09 -0400

Author: fernandes
Date: 2007-03-22 09:14:09 -0400 (Thu, 22 Mar 2007)
New Revision: 2270

Modified:
trunk/perfsonar-bundle/install.pl
Log:
Corrected perl services modification for multiple instances of the same type.
This should be the final version for testing.



Modified: trunk/perfsonar-bundle/install.pl
===================================================================
--- trunk/perfsonar-bundle/install.pl 2007-03-22 11:02:50 UTC (rev 2269)
+++ trunk/perfsonar-bundle/install.pl 2007-03-22 13:14:09 UTC (rev 2270)
@@ -43,9 +43,9 @@
);

my %serviceMap = (
- RRDMA() => "RRD-MA",
- SQLMA() => "SQL-MA",
- SSH() => "TelnetSSHMP",
+ RRDMA() => "RRD",
+ SQLMA() => "SQL",
+ SSH() => "SSH",
CLMP() => "CLMP",
LS() => "LS",
BWCTL() => "BWCTL",
@@ -53,11 +53,11 @@

my %servicesTar = (
RRDMA() =>
"http://anonsvn.internet2.edu/svn/pS-download/trunk/download/services/perfSONAR-RRD-MA-2.0-RC8.tar.gz";,
- CLMP() =>
"http://anonsvn.internet2.edu/svn/pS-download/trunk/download/services/perfSONAR-CLMP-1.0-RC5.tar.gz";,
- SSH() =>
"http://anonsvn.internet2.edu/svn/pS-download/trunk/download/services/MPTelnetSSH-0.10.tar.gz";,
+ CLMP() =>
"http://www.perfsonar.net/download/services/perfSONAR-CLMP-1.0.tar.gz";,
+ SSH() =>
"http://www.perfsonar.net/download/services/JAVA-SSHTELNET-MP-1.0.tar.gz";,
SQLMA() =>
"http://anonsvn.internet2.edu/svn/pS-download/trunk/download/services/perfSONAR-SQL-MA-1.0-RC5.tar.gz";,
LS() =>
"http://anonsvn.internet2.edu/svn/pS-download/trunk/download/services/perfSONAR-XML-LS-1.1-RC4.tar.gz";,
- BWCTL() =>
"http://anonsvn.internet2.edu/svn/pS-download/trunk/download/services/Perl-perfsonar-0.2-RC5.tar.gz";,
+ BWCTL() =>
"http://www.perfsonar.net/download/services/DFN_Perl-Base_BWCTL-MP-0.2.tar.gz";,
);

my $currentDir = `pwd`;
@@ -76,9 +76,8 @@
my $menu = "Welcome to the perfSONAR services installer.\n\n";
$menu .= "What would you like to do?\n";
$menu .= "1. Install a new service\n";
- $menu .= "2. Modify or test an existing installation (JAVA)\n";
- $menu .= "3. Modify or test an existing installation (PERL)\n";
- $menu .= "4. Give feedback to the perfSONAR team\n";
+ $menu .= "2. Modify or test an existing installation\n";
+ $menu .= "3. Give feedback to the perfSONAR team\n";
$menu .= "Please choose a number [enter to exit]: ";
print $menu;
my $choice = <STDIN>;
@@ -86,6 +85,7 @@

switch ($choice){
case 1 {
+ print "\nWhich service would like to install?\n";
&serviceMenu();
&installDir();
print "\nContinuing with installation... \n";
@@ -99,11 +99,6 @@
&advanced();
}
case 3 {
- $modification = '1';
- $isPerl = '1';
- &perlModifyMenu();
- }
- case 4 {
&getFeedback();
}
case "" { exit; }
@@ -112,35 +107,6 @@

}

-sub perlModifyMenu() {
- my $menu;
- my $key = PERL();
- my $tmp = 'ok';
-
-
- $menu = "\nWhat's the type of service that you want to modify/test?\n";
- while ($tmp ne '') {
- $menu .= "$key. $serviceDisplayMap{$key}\n";
- $key++;
- $tmp = $serviceDisplayMap{$key};
- }
- $menu .= "Please choose a number [enter to exit]: ";
- print $menu;
- $service = <STDIN>;
- chomp($service);
-
- if ($service eq ''){
- exit;
- }
-
- if (!($service =~ /^[1-9]$/) || $service >= $key || $service < PERL()){
- print "\nPlease type a valid number.\n";
- &perlModifyMenu();
- }
-
- &installDir();
-}
-
sub getFeedback(){
my $menu;
my $stop = '';
@@ -201,51 +167,72 @@
sub getProperties(){
my $menu;
my $const;
+
+ if (!$isPerl){
+ if (system("test -f
".$serviceDir."classes/perfsonar/conf/const.properties") != 0){
+ $menu = "\nI could not find the const.properties file last used
for this \n";
+ $menu .= "service. If you know it's location you can now type
it's path or \n";
+ $menu .= "else just press enter to use the one currently in the
configured \n";
+ $menu .= "installation directory. \n";
+ print $menu;
+ $const = <STDIN>;
+ chomp($const);

- if (system("test -f
".$serviceDir."classes/perfsonar/conf/const.properties") != 0){
- $menu = "\nI could not find the const.properties file last used for
this \n";
- $menu .= "service. If you know it's location you can now type it's
path or \n";
- $menu .= "else just press enter to use the one currently in the
configured \n";
- $menu .= "installation directory. \n";
- print $menu;
- $const = <STDIN>;
- chomp($const);
-
- if (!($const =~ /const.properties$/) || system("test -f ".$const) !=
0){
- if ($const ne ''){
- print "\nThe file $const doesn't seems to be valid.\n\n";
+ if (!($const =~ /const.properties$/) || system("test -f
".$const) != 0){
+ if ($const ne ''){
+ print "\nThe file $const doesn't seems to be valid.\n\n";
+ }
+ print "Using the one currently in the installation
directory...\n";
+ }else{
+ if (system("cp $const ".$installDir."ant/") != 0){
+ $menu = "\nAn error occurred when trying to copy the
given file to \n";
+ $menu .= $installDir."ant/. \n";
+ $menu .= "You can try to do this manually, otherwise the
const.properties file \n";
+ $menu .= "already located in the installation directory
will be used. \n";
+ $menu .= "Press any key when you're ready to continue...
\n";
+ print $menu;
+ <STDIN>;
+ }else{
+ print "File copied successfully. Continuing...\n";
+ }
+ system("cp $const ".$serviceDir.
+ "classes/perfsonar/conf/const.properties
".$installDir."ant/ 2> /dev/null");
}
- print "Using the one currently in the installation
directory...\n";
}else{
- if (system("cp $const ".$installDir."ant/") != 0){
- $menu = "\nAn error occurred when trying to copy the given
file to \n";
- $menu .= $installDir."ant/. \n";
+ print "\nI'm now copying the latest configuration used for this
service...\n";
+ if (system("cp ".$serviceDir.
+ "classes/perfsonar/conf/const.properties
".$installDir."ant/" != 0)){
+
+ $menu = "\nAn error occurred when trying to copy the file
const.properties from \n";
+ $menu .= $serviceDir."classes/perfsonar/conf/. \n";
$menu .= "You can try to do this manually, otherwise the
const.properties file \n";
$menu .= "already located in the installation directory will
be used. \n";
$menu .= "Press any key when you're ready to continue... \n";
print $menu;
<STDIN>;
- }else{
- print "File copied successfully. Continuing...\n";
}
- system("cp $const ".$serviceDir.
- "classes/perfsonar/conf/const.properties
".$installDir."ant/ 2> /dev/null");
}
}else{
- print "\nI'm now copying the latest configuration used for this
service...\n";
- if (system("cp ".$serviceDir.
- "classes/perfsonar/conf/const.properties
".$installDir."ant/" != 0)){
-
- $menu = "\nAn error occurred when trying to copy the file
const.properties from \n";
- $menu .= $serviceDir."classes/perfsonar/conf/. \n";
- $menu .= "You can try to do this manually, otherwise the
const.properties file \n";
- $menu .= "already located in the installation directory will be
used. \n";
+ my $ok = '';
+ if (system("test -d ".$serviceDir.".install") == 0){
+ chdir($serviceDir.".install");
+ if (system("cp configure deploy undeploy test $installDir") ==
0){
+ $ok = 'true';
+ }
+ chdir($currentDir);
+ }
+ if (!$ok){
+ $menu = "\nI couldn't copy the installation files last used for
this service.\n";
+ $menu .= "The files configure, deploy, test and undeploy, which
should be in \n";
+ $menu .= "the directory $serviceDir.install/, \n";
+ $menu .= "should be copied to $installDir. \n";
+ $menu .= "If these files are not copied, the files currently in
the installation \n";
+ $menu .= "directory will be used.\n";
$menu .= "Press any key when you're ready to continue... \n";
print $menu;
<STDIN>;
}
}
-
}

sub modifyMenu() {
@@ -261,35 +248,19 @@

for my $key ( keys %serviceMap ) {
if ($serviceDir =~ /$serviceMap{$key}/){
- $service = $key;
+ $service = $key;
}
}

if ($service){
+ if ($service >= PERL()){
+ $isPerl = 'true';
+ }
&installDir();
}else {
- $menu = "\nI couldn't detect the type of the service you want \n";
- $menu .= "to modify. You'll need to do this manually: \n";
- $menu .= "1. RRD-MA\n";
- $menu .= "2. SQL-MA\n";
- $menu .= "3. SSH/Telnet MP\n";
- $menu .= "4. Commande Line MP\n";
- $menu .= "Please choose a number [enter to exit]: ";
- while ($invalid){
- print $menu;
- $service = <STDIN>;
- chomp($service);
-
- if ($service == ""){
- exit;
- }
-
- if (!($service =~ /^[1234]$/)){
- print "\nPlease type a valid number.\n\n";
- }else{
- $invalid = 0;
- }
- }
+ print "\nI couldn't detect the type of the service you want \n";
+ print "to modify. You'll need to do this manually: \n";
+ &serviceMenu();
&installDir();
}
}
@@ -307,7 +278,6 @@

for ($i=0 ; $i < scalar(@dirs) ; $i++){
$serviceName = $dirs[$i];
- $serviceName =~ s/\/WEB-INF//;
$serviceName =~ s/.*\///;
$dirs[$i] .= '/';
$menu .= ($i+1).". $serviceName\n";
@@ -326,16 +296,17 @@
$invalid = 0;
}
case ($i+1) {
- print "\nPlease type the path to the 'WEB-INF' directory
of \n";
- print "the desired service: ";
+ print "\nPlease type the path to the directory of the
desired service:\n";
$serviceDir = <STDIN>;
chomp($serviceDir);

- if ($serviceDir =~ /WEB-INF$/){
+ if ($serviceDir =~ /\/$/){
$serviceDir .= '/';
}

- if (system("test -d ".$serviceDir) != 0 || !($serviceDir
=~ /WEB-INF\/$/)){
+ if (system("test -d ".$serviceDir) != 0 ||
+ (system("test -d ".$serviceDir."WEB-INF") != 0
+ && system("test -f
".$serviceDir."bin/perfsonar.pl") != 0)) {
print "\nDirectory $serviceDir doesn't seems to be a
valid directory.\n\n";
}else {
$invalid = 0;
@@ -357,7 +328,9 @@
$serviceDir .= '/';
}

- if (system("test -d ".$serviceDir) != 0){
+ if (system("test -d ".$serviceDir) != 0 ||
+ (system("test -d ".$serviceDir."WEB-INF") != 0 &&
+ system("test -f ".$serviceDir."bin/perfsonar.pl") != 0))
{
print "\nDirectory $serviceDir doesn't seems to be a valid
directory.\n\n";
exit;
}
@@ -452,7 +425,17 @@
}

sub detectExistingService(){
+ my @perl;
+ my $i;
@dirs = `find $webappsDir -type d -regex ".*WEB-INF\$"`;
+ for ($i=0 ; $i < scalar(@dirs) ; $i++){
+ $dirs[$i] =~ s/\/WEB-INF//;
+ }
+ @perl = `find $webappsDir -regex ".*bin/perfsonar\.pl\$"`;
+ for ($i=0 ; $i < scalar(@perl) ; $i++){
+ $perl[$i] =~ s/\/bin\/perfsonar\.pl//;
+ }
+ push(@dirs, @perl);
chomp(@dirs);
if (scalar(@dirs) > 0) { return 'true'; }
else { return ''; }
@@ -619,11 +602,10 @@
}

sub serviceMenu(){
- my $menu;
+ my $menu = "";
my $key = 1;
my $tmp = $serviceDisplayMap{$key};

- $menu = "\nWhich service would like to install?\n";
while ($tmp ne '') {
$menu .= "$key. $serviceDisplayMap{$key}\n";
$key++;
@@ -651,13 +633,13 @@
}

sub detectExistingInstall(){
- my $regex = "\".*$serviceMap{$service}.*/perfsonar/ant\$\"";
- if ($isPerl){
- $regex = "\".*$serviceMap{$service}.*/pre-install\$\""
- }
+ my @perl;
my @confSD;
- @dirs = `find $currentDir -type d -regex $regex`;
+ @dirs = `find $currentDir -type d -regex
".*$serviceMap{$service}.*/perfsonar/ant\$"`;
+ @perl = `find $currentDir -regex
".*$serviceMap{$service}.*/pre-install\$"`;
@confSD = `cat .install.conf | grep $serviceMap{$service} | cut -d "="
-f 2`;
+ chomp(@perl);
+ push(@dirs, @perl);
push(@dirs, @confSD);
if (scalar(@dirs) > 0) { return 'true' }
else { return '' };
@@ -724,9 +706,7 @@
}
}

- if(!$isPerl){
- &copyConst();
- }
+ &copyProperties();

&test();
if ($answer =~ /^y$/ or $answer =~ /^yes$/){
@@ -771,7 +751,7 @@
case 2 { print "\nExecuting action configure...\n\n";
&action('configure', $verbose); }
case 3 {
print "\nExecuting action deploy...\n\n";
&action('deploy', $verbose);
- if (!$isPerl) { &copyConst(); }
+ &copyProperties();
}
case 4 { print "\nExecuting action test...\n\n";
&action('test', $verbose); }
case 5 { print "\nExecuting action undeploy...\n\n";
&action('undeploy', $verbose); }
@@ -804,28 +784,71 @@
}
}

-sub copyConst(){
+sub copyProperties(){
my $menu;
- my $tmp = $installDir."ant/const.properties";
- my $web = `cat $tmp | grep "service.home" | cut -d '=' -f 2`;
- chomp($web);
- my $name = `cat $tmp | grep "^service.name" | cut -d '=' -f 2`;
- chomp($name);

- if (system("cp ".$installDir."ant/const.properties ".$web."/"
- .$name."/WEB-INF/classes/perfsonar/conf/const.properties")
!= 0){
+ if (!$isPerl){
+ my $tmp = $installDir."ant/const.properties";
+ my $web = `cat $tmp | grep "service.home" | cut -d '=' -f 2`;
+ chomp($web);
+ my $name = `cat $tmp | grep "^service.name" | cut -d '=' -f 2`;
+ chomp($name);

- $menu = "\nAn error occurred when trying to copy the file
const.properties to \n";
- $menu .= "the directory where the service was installed. The
directory used was: \n";
- $menu .= $web."/".$name."/WEB-INF/classes/perfsonar/conf/ \n";
- $menu .= "This file is copied so that it can be used in future
modifications \n";
- $menu .= "to the service through the use of this script. I recommend
that you \n";
- $menu .= "copy the file ".$installDir."ant/const.properties \n";
- $menu .= "to the mentioned directory (or to the right one if the
path detected \n";
- $menu .= "of the service's WEB-INF directory is wrong). \n";
- $menu .= "Press any key to continue...\n";
- print $menu;
- <STDIN>;
+ if (system("cp ".$installDir."ant/const.properties ".$web."/"
+
.$name."/WEB-INF/classes/perfsonar/conf/const.properties") != 0){
+
+ $menu = "\nAn error occurred when trying to copy the file
const.properties to \n";
+ $menu .= "the directory where the service was installed. The
directory used was: \n";
+ $menu .= $web."/".$name."/WEB-INF/classes/perfsonar/conf/ \n";
+ $menu .= "This file is copied so that it can be used in future
modifications \n";
+ $menu .= "to the service through the use of this script. I
recommend that you \n";
+ $menu .= "copy the file ".$installDir."ant/const.properties \n";
+ $menu .= "to the mentioned directory (or to the right one if the
path detected \n";
+ $menu .= "of the service's WEB-INF directory is wrong). \n";
+ $menu .= "Press any key to continue...\n";
+ print $menu;
+ <STDIN>;
+ }
+ }else{
+ my $ok = 'true';
+ chdir($installDir);
+ my $path = `cat configure | grep "my \\\$installpath" | cut -d '"'
-f 2`;
+ chomp($path);
+
+ if (!($path =~ /\/$/)){
+ $path .= "/";
+ }
+ if (system("test -d ".$path.".install") != 0){
+ if (system("mkdir ".$path.".install") != 0){
+ print "Please create the directory ".$path.".install now.\n";
+ print "This directory is used by this installer script for
future modifications\n";
+ print "or tests for the installed service.\n";
+ print "Press any key when you're done...\n";
+ <STDIN>;
+ if (system("test -d ".$path.".install") == 0){
+ $ok = '';
+ }
+ }
+ }
+ if($ok){
+ if (system("cp configure deploy undeploy test
".$path.".install") != 0){
+ $ok = '';
+ }
+ }
+ if(!$ok){
+ $menu = "\nAn error occurred when trying to copy some of the
installation files to\n";
+ $menu .= "the directory where the service was installed. The
directory used was: \n";
+ $menu .= $path.".install \n";
+ $menu .= "This file is copied so that it can be used in future
modifications to\n";
+ $menu .= "the service through the use of this script. I
recommend that you copy\n";
+ $menu .= "the files configure, deploy, undeploy and test from
the directory\n";
+ $menu .= "$installDir\n";
+ $menu .= "to the first mentioned directory (creating it if
necessary, or correcting\n";
+ $menu .= "the path if the detected service directory is wrong).
\n";
+ $menu .= "Press any key to continue...\n";
+ print $menu;
+ <STDIN>;
+ }
+ chdir($installDir);
}
-
}



  • perfsonar: r2270 - trunk/perfsonar-bundle, svnlog, 03/22/2007

Archive powered by MHonArc 2.6.16.

Top of Page