perfsonar-dev - perfsonar: r2214 - trunk/perfsonar-bundle
Subject: perfsonar development work
List archive
- From:
- To:
- Subject: perfsonar: r2214 - trunk/perfsonar-bundle
- Date: Mon, 12 Mar 2007 11:15:29 -0400
Author: fernandes
Date: 2007-03-12 11:15:28 -0400 (Mon, 12 Mar 2007)
New Revision: 2214
Modified:
trunk/perfsonar-bundle/install.pl
Log:
Bundler installer script is almost done, try it out and give feedback if
possible...
Modified: trunk/perfsonar-bundle/install.pl
===================================================================
--- trunk/perfsonar-bundle/install.pl 2007-03-12 13:59:19 UTC (rev 2213)
+++ trunk/perfsonar-bundle/install.pl 2007-03-12 15:15:28 UTC (rev 2214)
@@ -7,12 +7,19 @@
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
+ CLMP => 4,
+ LS => 5,
+ BWCTL => 6,
+ PERL => 6 #The number where perl services start
};
my $service;
@@ -22,25 +29,34 @@
my $installDir;
my $webappsDir;
my @dirs;
+my $modification = '';
+my $isPerl = '';
my %serviceDisplayMap = (
RRDMA() => "RRD MA",
SQLMA() => "SQL MA",
SSH() => "SSH/Telnet MP",
- CLMP() => "Command Line MP"
+ CLMP() => "Command Line MP",
+ LS() => "Lookup Service",
+ BWCTL() => "BWCTL MP",
);
my %serviceMap = (
RRDMA() => "RRD-MA",
SQLMA() => "SQL-MA",
SSH() => "TelnetSSHMP",
- CLMP() => "CLMP"
+ CLMP() => "CLMP",
+ LS() => "LS",
+ BWCTL() => "BWCTL",
);
-my %servicesTar = ( RRDMA() =>
"ahttp://monstera.man.poznan.pl/jra1-wiki/images/files/perfSONAR-RRD-MA-2.0-RC5.tar.gz",
- CLMP() =>
"http://www.gt-med.ufsc.br/docs/downloads/piPEs-BR/GFD/CLMP/perfSONAR-CLMP-1.0-RC4.tar.gz",
- SSH() =>
"http://downloads.geant2.net/repository/perfSONAR/micro-releases/MPTelnetSSH-0.7.tar.gz",
- SQLMA() =>
"http://downloads.geant2.net/repository/perfSONAR/micro-releases/perfSONAR-SQL-MA-1.0-RC3.tar.gz"
+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",
+ 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",
);
my $currentDir = `pwd`;
@@ -60,29 +76,142 @@
$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 {
+ case 1 {
&serviceMenu();
&installDir();
print "\nContinuing with installation... \n";
&installTypeMenu();
}
- case 2 {
+ case 2 {
+ $modification = '1';
&modifyMenu();
+ &getProperties();
print "\nSetup complete. Continuing... \n";
&advanced();
}
- case "" { exit; }
- else { print "\nPlease type a valid number.\n"; }
+ 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=122345='.$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 (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>;
+ }
+ }
+
+}
+
sub modifyMenu() {
my $menu;
my $choice;
@@ -125,7 +254,6 @@
$invalid = 0;
}
}
-
&installDir();
}
}
@@ -234,6 +362,7 @@
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;
}
}
@@ -251,8 +380,12 @@
chomp($choice);
$webappsDir = $dirs[0];
- if ($choice != ''){
- $webappsDir = $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";
@@ -264,28 +397,36 @@
$menu .= "directory. Please type the location of your webapps \n";
$menu .= "directory now [enter exits]: ";
print $menu;
- $choice = <STDIN>;
+ $choice = <STDIN>;
chomp($choice);
-
- if ($choice != ''){
- $webappsDir = $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(){
@dirs = `find $webappsDir -type d -regex ".*WEB-INF\$"`;
chomp(@dirs);
- if (scalar(@dirs) > 0) { return 'true' }
- else { return '' };
+ 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 '' };
@@ -300,13 +441,19 @@
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. If you \n";
- $menu .= "have already downloaded and extracted these files, you \n";
- $menu .= "can choose to give the directory location. Otherwise, \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";
}
@@ -315,7 +462,11 @@
$menu .= "2. Give the path to existing $serviceDisplayMap{$service}
installation files directory\n";
for ($i=0 ; $i < scalar(@dirs) ; $i++){
- $dirs[$i] =~ s/\/ant/\//;
+ 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]: ";
@@ -338,16 +489,26 @@
if (!($installDir =~ /\/$/)){
$installDir .= '/';
}
+
+ if (!$isPerl){
+ if (!($installDir =~ /perfsonar\/$/)){
+ $installDir .= 'perfsonar/';
+ }
- 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;
+ }
}
-
- if (system("test -f ".$installDir."ant/build.xml") != 0){
- print "\nDirectory $installDir doesn't seems to be a
valid directory.\n\n";
- }else {
- $invalid = 0;
- }
}
case [3..$i] {
$installDir = $dirs[$choice-3];
@@ -391,51 +552,77 @@
$choice = <STDIN>;
chomp($choice);
- $installDir = "./";
+ $installDir = $currentDir;
if ($choice != ''){
if (!($choice =~ /\/$/)){
$choice = $choice . "/";
}
+
$installDir = $choice
}
print "\nExtracting service $serviceDisplayMap{$service} installation
files...\n\n";
if (system("tar -zxvf $file -C $installDir") != 0){
- print "error";
+ 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.'/perfsonar/';
+ $installDir .= $file."/";
+ if (!$isPerl){
+ $installDir .= "perfsonar/";
+ }
+
+ if (!($installDir =~ /^\./) && !($installDir =~ /$currentDir/)){
+ `echo "$serviceMap{$service}=$installDir" >> .install.conf`;
+ }
return 0;
}
sub serviceMenu(){
-
- my $menu = "\nWhich service would like to install?\n";
- $menu .= "1. RRD-MA\n";
- $menu .= "2. SQL-MA\n";
- $menu .= "3. SSH/Telnet MP\n";
- $menu .= "4. Commande Line MP\n";
+ 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++;
+ $tmp = $serviceDisplayMap{$key};
+ }
$menu .= "Please choose a number [enter to exit]: ";
print $menu;
$service = <STDIN>;
chomp($service);
- if ($service == ""){
+ if ($service eq ''){
exit;
}
- if (!($service =~ /^[1234]$/)){
- print "\nPlease type a valid number.\n\n";
- &installationMenu;
+ if (!($service =~ /^[1-9]$/) || $service >= $key){
+ print "\nPlease type a valid number.\n";
+ &serviceMenu();
}
+
+ if ($service >= PERL()){
+ $isPerl = 'true';
+ }else{
+ $isPerl = '';
+ }
}
sub detectExistingInstall(){
my $regex = "\".*$serviceMap{$service}.*/perfsonar/ant\$\"";
+ if ($isPerl){
+ $regex = "\".*$serviceMap{$service}.*/pre-install\$\""
+ }
+ my @confSD;
@dirs = `find $currentDir -type d -regex $regex`;
+ @confSD = `cat .install.conf | grep $serviceMap{$service} | cut -d "="
-f 2`;
+ push(@dirs, @confSD);
if (scalar(@dirs) > 0) { return 'true' }
else { return '' };
}
@@ -496,6 +683,10 @@
return;
}
}
+
+ if(!$isPerl){
+ ©Const();
+ }
&test();
if ($answer =~ /^y$/ or $answer =~ /^yes$/){
@@ -527,7 +718,7 @@
$menu .= "3. deploy\n";
$menu .= "4. test\n";
$menu .= "5. undeploy\n";
- $menu .= "6. change service\n";
+ $menu .= "6. restart script\n";
$menu .= "0. exit\n";
$menu .= "Please choose a number: ";
print $menu;
@@ -536,11 +727,11 @@
chomp($choice);
switch ($choice){
- case 1 { &action('pre-install'); }
- case 2 { &action('configure'); }
- case 3 { &action('deploy'); }
- case 4 { &action('test'); }
- case 5 { &action('undeploy'); }
+ case 1 { print "\nExecuting action pre-install...\n\n";
&action('pre-install'); }
+ case 2 { print "\nExecuting action configure...\n\n";
&action('configure'); }
+ case 3 { print "\nExecuting action deploy...\n\n";
&action('deploy'); if (!$isPerl) { ©Const(); } }
+ case 4 { print "\nExecuting action test...\n\n";
&action('test'); }
+ case 5 { print "\nExecuting action undeploy...\n\n";
&action('undeploy'); }
case 6 { return; }
case 0 { exit; }
case "" { exit; }
@@ -553,5 +744,37 @@
sub action(){
my $target = shift(@_);
- $returnCode = system "ant -q -f " . $installDir . "ant/build.xml " .
$target;
+ if (!$isPerl){
+ $returnCode = system "ant -q -f " . $installDir . "ant/build.xml " .
$target;
+ }else{
+ chdir($installDir);
+ $returnCode = system "perl ".$target;
+ chdir($currentDir);
+ }
}
+
+sub copyConst(){
+ 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){
+
+ $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>;
+ }
+
+}
- perfsonar: r2214 - trunk/perfsonar-bundle, svnlog, 03/12/2007
Archive powered by MHonArc 2.6.16.