Skip to Content.
Sympa Menu

perfsonar-user - Re: [Fwd: Re: perfSONAR]

Subject: perfSONAR User Q&A and Other Discussion

List archive

Re: [Fwd: Re: perfSONAR]


Chronological Thread 
  • From: Loukik Kudarimoti <>
  • To: "Constantinos E. Marinos" <>
  • Cc: , Szymon Trocha <>, Roman Lapacz <>, Mary Grammatikou <>
  • Subject: Re: [Fwd: Re: perfSONAR]
  • Date: Mon, 04 Jun 2007 15:38:56 +0100

Constantinos,

I just ran the file that you mailed to me and it works perfectly fine on our workstation (perl v5.8.5). In fact this error is the first of its kind reported so far.

I have raised a bug report on this issue. During investigation of this bug over the next few days, if we can get a temporary access to your console to figure out why perl on your machine is not happy with it, it would greatly speed up the process. Any chance of you setting up a temporary account on the machine for us?

thanks,
Loukik.


Constantinos E. Marinos wrote:
Hi Loukik,
It is the latest install.pl file that i have download from wiki.
I'm using Perl v.5.8.0.

cmarinos

Loukik Kudarimoti wrote:
Strange. Can you mail us the install.pl file that you are using?

Also, what version of perl are you using?

Loukik.


Constantinos E. Marinos wrote:
Hi Roman, Loukik, Szymon,

thank you for your fast response. Unfortunately,
i have installed every requirement but i still come across to this message:

[:/home/cmarinos/opt/perfsonar-bundle-2.0]# perl install.pl
Bad switch statement (problem in the code block?) near install.pl line 309

You might be using the RC2 of perfsonar bundle (which had some problems).
I'm using the latest version perfsonar-bundle-2.0.tar.gz
Just to clarify: do you have your own tools to do the measurements and you need perfSONAR only to publish stored measurement result? Or do you need also measurement tools (perfsonar enabled) to get values of metrics mentioned in the document you sent me?
We don't have any measurements tools, we want perfsonar to be enabled with these tools as well.

Best Regards,
Costas

------------------------------------------------------------------------

#!/usr/bin/perl

# Version: $Id: install.pl 2426 2007-05-24 11:59:42Z loukik $
# Author: Guilherme Fernandes

package perfsonar;

use Switch;
use strict;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST =>
'http://mu.dante.org.uk:8092/Emailer/mailer.jsp');
$req->content_type('application/x-www-form-urlencoded');

use constant {
RRDMA => 1,
SQLMA => 2,
SSH => 3,
CLMP => 4,
LS => 5,
BWCTL => 6,
PERL => 6 #The number where perl services start
};

my $service;
my $serviceDir;
my $returnCode;
my $answer;
my $installDir;
my $webappsDir;
my @dirs;
my $modification = '';
my $isPerl = '';
my $verbose = '';

my %serviceDisplayMap = ( RRDMA() => "RRD MA",
SQLMA() => "SQL MA",
SSH() => "SSH/Telnet MP",
CLMP() => "Command Line MP",
LS() => "Lookup Service",
BWCTL() => "BWCTL MP",
);

my %serviceMap = ( RRDMA() => "RRD",
SQLMA() => "SQL",
SSH() => "SSH",
CLMP() => "CLMP", LS() => "LS",
BWCTL() => "BWCTL",
);

my %servicesTar = ( RRDMA() => "http://www.perfsonar.net/download/services/services_download.php?product=perfSONAR-RRD-MA&version=2.2";,
CLMP() =>
"http://www.perfsonar.net/download/services/services_download.php?product=perfSONAR-CLMP&version=1.1";,
SSH() =>
"http://www.perfsonar.net/download/services/services_download.php?product=JAVA-SSHTELNET-MP&version=1.1";,
SQLMA() =>
"http://www.perfsonar.net/download/services/services_download.php?product=perfSONAR-SQL-MA&version=1.3";,
LS() =>
"http://www.perfsonar.net/download/services/services_download.php?product=XML-LS&version=1.1.1";,
BWCTL() =>
"http://www.perfsonar.net/download/services/services_download.php?product=DFN_Perl-Base_BWCTL-MP&version=0.2";,
);
my %serviceFilesTar = ( RRDMA() => "perfSONAR-RRD-MA-2.2.tar.gz",
CLMP() => "perfSONAR-CLMP-1.1.tar.gz",
SSH() => "JAVA-SSHTELNET-MP-1.1.tar.gz",
SQLMA() => "perfSONAR-SQL-MA-1.3.tar.gz",
LS() => "XML-LS-1.1.1.tar.gz",
BWCTL() => "DFN_Perl-Base_BWCTL-MP-0.2.tar.gz",
);

my $currentDir = `pwd`;
chomp($currentDir);
$currentDir .= "/";

while('true'){

&introMenu();

}


sub introMenu(){

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\n";
$menu .= "3. Give feedback to the perfSONAR team\n";
$menu .= "Please choose a number [enter to exit]: ";
print $menu;
my $choice = <STDIN>;
chomp($choice);

switch ($choice){
case 1 { print "\nWhich service would like to install?\n";
&serviceMenu();
&installDir(); print "\nContinuing with installation... \n";
&installTypeMenu();
}
case 2 { $modification = '1';
&modifyMenu(); &getProperties();
print "\nSetup complete. Continuing... \n";
&advanced();
}
case 3 { &getFeedback();
}
case "" { exit; }
else { print "\nPlease type a valid number.\n"; }
}

}

sub getFeedback(){
my $menu;
my $stop = '';
my $message;
my $name; my $email;
my $org; my $tmp;

$menu = "\nBe free to write any complaints, suggestions or comments, any type
\n";
$menu .= "of feedback is appreciated. Your feedback will be sent to
perfSONAR's \n";
$menu .= "<XXX> mailing list. You'll be asked to give some personal
information \n";
$menu .= "first, it is completely optional (you can just press enter to
ignore): \n";
$menu .= "\nYour name: ";
print $menu;
$name = <STDIN>;
chomp($name);

print "Email: ";
$email = <STDIN>;
chomp($email);

print "Organization: ";
$org = <STDIN>;
chomp($org);

$message = "Name: $name\n"."Email: $email\n"."Organization: $org\n\n";

print "You can now type your message, write 'STOP' in a newline when you have finished.\n"; while (!$stop){
$tmp = <STDIN>;
chomp($tmp);

if ($tmp ne 'STOP'){
$message .= $tmp."\n";
}
else{
$stop = 'true';
}
}

print "\nSending your feedback...\n";

$req->content('message=12345='.$message);
my $res = $ua->request($req);

if ($res->is_success && !($res->as_string =~ /NOT-OK/)){
print "\n\nYour feedback was sent successfully, thank you!\n\n";
}else{
print "\n\nAn error ocurred while trying to send your feedback. Please
take\n";
print "your time to write it to
<feedbackml>\@perfsonar.net,
it's very \n";
print "important to us. Thank you!\n";
print "Press any key to continue...\n";
<STDIN>;
}
}

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 (!($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");
}
}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";
$menu .= "Press any key when you're ready to continue... \n";
print $menu;
<STDIN>;
}
}
}else{
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() {
my $menu;
my $choice;
my $invalid = 1;
my $i;
my $serviceName;

&getWebapps();

&getServiceDir();

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

if ($service){
if ($service >= PERL()){
$isPerl = 'true';
}
&installDir();
}else {
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();
}
}

sub getServiceDir() {
my $menu;
my $choice;
my $invalid = 1;
my $i;
my $serviceName;

if (&detectExistingService()){
$menu = "\nI have detected the following services under the directory
\n";
$menu .= "$webappsDir:\n";

for ($i=0 ; $i < scalar(@dirs) ; $i++){
$serviceName = $dirs[$i];
$serviceName =~ s/.*\///;
$dirs[$i] .= '/';
$menu .= ($i+1).". $serviceName\n";
} $menu .= ($i+1).". Type the path to a different service.\n";
$menu .= "Please choose a number [enter exits]: ";
while ($invalid){
print $menu;

$choice = <STDIN>;
chomp($choice);

switch ($choice){
case [1..$i] { $serviceDir = $dirs[$choice-1]; $invalid = 0;
}
case ($i+1) { print "\nPlease type the path to the directory of the desired service:\n";
$serviceDir = <STDIN>;
chomp($serviceDir);

if ($serviceDir =~ /\/$/){
$serviceDir .= '/';
}

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;
}
}
case "" { exit; }
}
} }else{
$menu .= "\nI haven't been able to detect existing services inside
\n";
$menu .= "the directory $webappsDir.\n";
$menu .= "Please type the path to the 'WEB-INF' directory of the \n";
$menu .= "service you want to modify [enter exits]:\n";
print $menu;
$serviceDir = <STDIN>;
chomp($serviceDir);

if (!($serviceDir =~ /\/$/)){
$serviceDir .= '/';
}

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;
}
}
}

sub getWebapps() {
my $menu;
my $choice;
my $invalid = 1;
my $i;

if (&detectWebapps()){
$menu .= "\nI have detected the webapps directory at the following
\n";
if (scalar(@dirs) > 1) { $menu .= "paths:\n";
for ($i=0 ; $i < scalar(@dirs) ; $i++){
$menu .= ($i+1).". Use ".$dirs[$i]."\n";
} $menu .= ($i+1).". Type a different path for webapps directory.\n";
$menu .= "Please choose a number [enter exits]: ";
while ($invalid){
print $menu;

$choice = <STDIN>;
chomp($choice);

switch ($choice){
case [1..$i] { $webappsDir = $dirs[$choice-1]; $invalid = 0;
}
case ($i+1) { print "\nPlease type the path to the webapps directory: ";
$webappsDir = <STDIN>;
chomp($webappsDir);

if (system("test -d ".$webappsDir) != 0){
print "\nDirectory $webappsDir doesn't seems to be a
valid directory.\n\n";
}else {
`echo "webapps=$webappsDir" >> .install.conf`;
$invalid = 0;
}
}
case "" { exit; }
else { print "\nPlease type a valid number.\n"; }
}
}
}
else { $menu .= "path: $dirs[0]\n";
$menu .= "You can type now a different path or press enter to \n";
$menu .= "accept the above directory: ";
print $menu;
$choice = <STDIN>; chomp($choice);

$webappsDir = $dirs[0];
if ($choice ne ''){
$webappsDir = $choice;
if ($webappsDir ne $dirs[0]){
`echo "webapps=$webappsDir" >> .install.conf`;
}

}
if (system("test -d ".$webappsDir) != 0){
print "\nDirectory $webappsDir doesn't seems to be a valid
directory.\n\n";
exit;
}
}
}else{
$menu .= "\nI haven't been able to detect an existing webapps \n";
$menu .= "directory. Please type the location of your webapps \n";
$menu .= "directory now [enter exits]: "; print $menu;
$choice = <STDIN>;
chomp($choice);

if ($choice ne ''){
$webappsDir = $choice;
if ($webappsDir ne $dirs[0]){
`echo "webapps=$webappsDir" >> .install.conf`;
}
}

if (system("test -d ".$webappsDir) != 0){
print "\nDirectory $webappsDir doesn't seems to be a valid
directory.\n\n";
exit;
}

}
}

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 ''; }
}

sub detectWebapps(){
my @confSD;
@dirs = `find $currentDir -type d -regex ".*webapps\$" | grep -v
apache-tomcat`;
@confSD = `cat .install.conf | grep webapps | cut -d "=" -f 2`;
push(@dirs, @confSD);
chomp(@dirs);
if (scalar(@dirs) > 0) { return 'true' }
else { return '' };
}

sub installDir() {
my $menu;
my $choice;
my $invalid = 1;
my $i;

if (&detectExistingInstall()){
$menu .= "\nI have detected that there might be directories which \n";
$menu .= "already have the installation files for this service. \n";
if ($modification) {
$menu .= "(These files are also needed for service modifications.)
\n";
}
$menu .= "You can choose to use one of these, point to another \n";
$menu .= "directory, or download the installation files again: \n\n";
}else{
$menu .= "\nI haven't been able to detect an existing directory \n";
$menu .= "with the installation files for this service. \n";
if ($modification) {
$menu .= "(These files are also needed for service modifications.)
\n";
} $menu .= "If you have already downloaded and extracted these files, \n";
$menu .= "you can choose to give the directory location. Otherwise,
\n";
$menu .= "choose to download the installation files. \n\n";
}

$menu .= "What do you want to do?\n";
$menu .= "1. Download installation files\n";
$menu .= "2. Give the path to existing $serviceDisplayMap{$service}
installation files directory\n";

for ($i=0 ; $i < scalar(@dirs) ; $i++){
if ($isPerl){
$dirs[$i] =~ s/\/pre-install$/\//;
}else{
$dirs[$i] =~ s/\/ant$/\//;
}
$menu .= ($i+3).". Use ".$dirs[$i]."\n";
} $menu .= "Please choose a number [enter to exit]: ";
$i = $i + 3;

while ($invalid){
print $menu;

$choice = <STDIN>;
chomp($choice);

switch ($choice){
case 1 { $invalid = &download(); }
case 2 { print "\nPlease type the path to service $serviceDisplayMap{$service}'s installation files \n";
print "directory: ";
$installDir = <STDIN>;
chomp($installDir);

if (!($installDir =~ /\/$/)){
$installDir .= '/';
}

if (!$isPerl){
if (!($installDir =~ /perfsonar\/$/)){
$installDir .= 'perfsonar/';
}

if (system("test -f ".$installDir."ant/build.xml") != 0){
print "\nDirectory $installDir doesn't seems to be a valid
directory.\n\n";
}else {
`echo "$serviceMap{$service}=$installDir" >>
.install.conf`;
$invalid = 0;
}
}else{
if (system("test -f ".$installDir."pre-install") != 0){
print "\nDirectory $installDir doesn't seems to be a valid
directory.\n\n";
}else {
`echo "$serviceMap{$service}=$installDir" >>
.install.conf`;
$invalid = 0;
}
}
}
case [3..$i] { $installDir = $dirs[$choice-3]; $invalid = 0;
}
case "" { exit; }
else { print "\nPlease type a valid number.\n"; }
}
}

chomp($installDir);

}

sub download(){
my $menu;
my $choice;
my $file = $serviceFilesTar{$service};
print "\nDownloading installation files for service ".$serviceDisplayMap{$service}.".\n";
print "This might take a while depending on your connection speed...\n\n";
print "Please do not press any key until the file download process is complete.\n";
print "When the download process has finished, press any key. Okay? \n\n";
<STDIN>;
my $systemSignal = system("wget $servicesTar{$service}");
<STDIN>;
if ($systemSignal != 0){
my $notice = "\nThere seems to be a problem downloading the installation
files from \n";
$notice .= "$servicesTar{$service}. \n";
$notice .= "Please try to download this file manually and put it in my
directory \n";
$notice .= "($currentDir). \n";
$notice .= "Press any key when you have finished or CTRL+C to
exit...\n";
print $notice;
<STDIN>; }

`test -s $file` == 0 or die "FATAL: file $file is not present.";

$menu = "\nI'll now untar the installation files directory into my current
\n";
$menu .= "directory ($currentDir). \n";
$menu .= "If you would like to extract the files to another directory, please
\n";
$menu .= "type it now or else just press enter to accept the above
directory.\n";
print $menu;
$choice = <STDIN>; chomp($choice);

$installDir = $currentDir;
if ($choice != ''){
if (!($choice =~ /\/$/)){
$choice = $choice . "/";
}

$installDir = $choice
}

print "\nExtracting service $serviceDisplayMap{$service} installation
files...\n\n";

if (system("gzip -d $file") != 0){
print "\nAn error occurred while trying to unzip the installions
files.\n";
print "\nReturning to the last menu...\n";
return 1;
}
my @arr=split /\.gz/, $file;
my $file_unzipped = $arr[0];
if (system("tar -xvf $file_unzipped -C $installDir") != 0){
print "\nAn error occurred while trying to extract the installions
files.\n";
print "\nReturning to the last menu...\n";
return 1;
}

$file =~ s/\.tar.*//;
$installDir .= $file."/";
if (!$isPerl){
$installDir .= "perfsonar/";
}

if (!($installDir =~ /^\./) && !($installDir =~ /$currentDir/)){
`echo "$serviceMap{$service}=$installDir" >> .install.conf`;
}

return 0;
}

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

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){
print "\nPlease type a valid number.\n";
&serviceMenu();
}

if ($service >= PERL()){
$isPerl = 'true';
}else{
$isPerl = '';
}
}

sub detectExistingInstall(){
my @perl;
my @confSD;
@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 '' };
}

sub installTypeMenu(){
my $menu = "\nWhich installation type do you want?\n";
$menu .= "1. Basic\n";
$menu .= "2. Advanced\n";
$menu .= "Please choose a number [enter to exit]: ";

print $menu;
my $choice = <STDIN>;
chomp($choice);

switch ($choice){
case 1 { &basic(); }
case 2 { &advanced(); }
case "" { exit; }
else { print "\nPlease type a valid number.\n";
&installTypeMenu(); }
}
}

sub basic(){
my $verbose = '';
if ($service == SSH()){
$verbose = 'true';
}

print "\nStarting installation for service
$serviceDisplayMap{$service}...\n";
&action('pre-install');

if ($returnCode != 0){
&error();
if ($answer =~ /^y$/ or $answer =~ /^yes$/){
&action('pre-install');
}
if ($returnCode != 0){
return;
} }

&action('configure', $verbose);

if ($returnCode != 0){
&error();
if ($answer =~ /^y$/ or $answer =~ /^yes$/){
&action('configure', $verbose);
}
if ($returnCode != 0){
return;
} }

&action('deploy');

if ($returnCode != 0){
&error();
if ($answer =~ /^y$/ or $answer =~ /^yes$/){
&action('deploy');
}
if ($returnCode != 0){
return;
} }

&copyProperties();

&test();
if ($answer =~ /^y$/ or $answer =~ /^yes$/){
&action('test', 1);
}

}

sub test(){
my $menu = "\nApparently the installation was successful.\n";
$menu .= "Would you like to test the service? (y, n): ";
print $menu;
$answer = <STDIN>;
}

sub error(){
my $menu = "\n\nIt seems an error occurred in one of the installation
steps.\n";
$menu .= "Would you like to try that step again?\n";
$menu .= "(yes [y] or [yes] to try, anything else goes back to the
installation menu): ";
print $menu;
$answer = <STDIN>;
}

sub advanced(){
my $menu = "\nAvailable actions: \n";
$menu .= "1. pre-install\n";
$menu .= "2. configure\n";
$menu .= "3. deploy\n";
$menu .= "4. test\n";
$menu .= "5. undeploy\n";
$menu .= "6. enable/disable verbose\n";
$menu .= "7. restart script\n";
$menu .= "0. exit\n";
$menu .= "Please choose a number: ";
print $menu;
my $choice = <STDIN>;

chomp($choice);

switch ($choice){
case 1 { print "\nExecuting action pre-install...\n\n";
&action('pre-install', $verbose); }
case 2 { print "\nExecuting action configure...\n\n"; if ($service == SSH()){ &action('configure', 1); }
else { &action('configure', $verbose); }
}
case 3 { print "\nExecuting action deploy...\n\n"; &action('deploy', $verbose); &copyProperties(); }
case 4 { print "\nExecuting action test...\n\n"; &action('test',
1); }
case 5 { print "\nExecuting action undeploy...\n\n";
&action('undeploy', $verbose); }
case 6 { if ($verbose) { $verbose = 0; print "\nVerbose installation has been disabled.\n"; }
else { $verbose = 'true'; print "\nVerbose installation has
been enabled.\n"; }
}
case 7 { return; }
case 0 { exit; }
else { print "\nPlease type a valid option.\n"; }
}

&advanced();

}

sub action(){
my $target = shift(@_);
my $notQuiet = shift(@_);
if (!$isPerl){
chdir($installDir."ant");
if ($notQuiet){
$returnCode = system "ant -f build.xml " . $target;
}else{
$returnCode = system "ant -q -f build.xml " . $target;
}
}else{
chdir($installDir);
$returnCode = system "perl ".$target;
}
chdir($currentDir);
}

sub copyProperties(){
my $menu;

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);
if ($name eq ''){
$name = `cat $tmp | grep "^deploy.root" | cut -d '=' -f 2`;
chomp($name);
}

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);
}
}



  • Re: [Fwd: Re: perfSONAR], Loukik Kudarimoti, 06/04/2007

Archive powered by MHonArc 2.6.16.

Top of Page