From b8984ab6826978cd506f2aa62cae2ee8e456274c Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 16 May 2016 10:52:32 -0500 Subject: [PATCH] tool changes for name changes --- tools/configMgt/autoInstaller.cpp | 127 ++++++++++++--------- tools/configMgt/dm_parent_installer.sh | 38 +++--- tools/configMgt/parent_binary_installer.sh | 24 ++-- tools/configMgt/pm_parent_installer.sh | 33 +++--- 4 files changed, 120 insertions(+), 102 deletions(-) diff --git a/tools/configMgt/autoInstaller.cpp b/tools/configMgt/autoInstaller.cpp index 035228ce3..db2247866 100644 --- a/tools/configMgt/autoInstaller.cpp +++ b/tools/configMgt/autoInstaller.cpp @@ -20,7 +20,7 @@ * * * List of files being updated by configure: -* Calpont/etc/Calpont.xml +* Calpont/etc" + installLocation + ".xml * * ******************************************************************************************/ @@ -64,6 +64,11 @@ int main(int argc, char *argv[]) string installDir = "/usr/local"; string MySQLport= oam::UnassignedName; string installPackageType = ""; + string product = "columnstore"; + string company = "MariaDB-Columnstore"; + string calpontPackagename = "mariadb-columnstore"; + string installLocation = "/MariaDB/Columnstore"; + string adminCommand = "" + adminCommand + ""; char* pcommand = 0; string prompt; @@ -72,7 +77,7 @@ int main(int argc, char *argv[]) int forceVer = -1; - Config* sysConfig = Config::makeConfig("./systems/CalpontSystems.xml"); + Config* sysConfig = Config::makeConfig("./systems" + installLocation + "Systems.xml"); //gethostname to determine where to get the packages string SHARED = "//srvhill01/shared"; @@ -96,16 +101,17 @@ int main(int argc, char *argv[]) cout << "configuration of the 'Calpont.xml' located on the system being" << endl; cout << "or can be passed as an argument into 'quickInstaller'." << endl; cout << endl; - cout << "Usage: autoInstaller -s system [-h][-ce][-r release][-c configFile][-n][-d][-p package-type][-m mysql-password][-port mysql-port]" << endl; + cout << "Usage: autoInstaller -s system [-h][-ce][-r release][-c configFile][-n][-d][-p package-type][-m mysql-password][-port mysql-port][-pr product-name]" << endl; cout << " -s system-name" << endl; cout << " -ce community-edition install" << endl; cout << " -r release-number (optional, default to 'Latest')" << endl; - cout << " -c InfiniDB Config File located in system-name directory (optional, default to system configuration)" << endl; + cout << " -c Config File located in system-name directory (optional, default to system configuration)" << endl; cout << " -n No Prompt (Used for automated Installs)" << endl; cout << " -port System MySQL Port, if set" << endl; cout << " -d Debug Flag" << endl; cout << " -p Install Package Type (rpm or binary), defaults to " << sysConfig->configFile() << " setting" << endl; cout << " -3 Force a version 3 install, defaults to autodetect" << endl; + cout << " -pr Product installing (infinidb or columnstore), defaults to columnstore" << endl; exit(0); } else if( string("-s") == argv[i] ) { @@ -167,6 +173,14 @@ int main(int argc, char *argv[]) else if( string("-3") == argv[i] ) { forceVer = 3; } + else if( string("-pr") == argv[i] ) { + i++; + if ( argc == i ) { + cout << "ERROR: product name type argument" << endl; + exit(1); + } + product = argv[i]; + } else { cout << "ERROR: Unknown option: " << argv[i] << endl; exit(1); @@ -175,10 +189,24 @@ int main(int argc, char *argv[]) if (systemName.empty() ) { cout << endl; + cout << "Missing system name" << endl; cout << "Usage: autoInstaller -s system [-h][-ce][-r release][-c configFile][-n][-d][-p package-type][-m mysql-password][-port mysql-port]" << endl; exit(1); } + if ( product == "infinidb" ) { + company = "InfiniDB"; + calpontPackagename = "infinidb"; + installLocation = "" + installLocation + ""; + adminCommand = "calpontConsole"; + } + else if ( product != "columnstore" ) + { + cout << endl; + cout << "Invalid product name" << endl; + exit(1); + } + // get Parent OAM Module based on system name int systemCount; try { @@ -249,8 +277,8 @@ int main(int argc, char *argv[]) systemPackage = "*x86_64.bin.tar.gz"; else { - cout << "Invalid InfiniDB Package Type Arugument entered, use 'rpm' or 'binary' exiting" << endl; - cerr << "Invalid InfiniDB Package Type Arugument entered, use 'rpm' or 'binary' exiting" << endl; + cout << "Invalid " + company + " Package Type Arugument entered, use 'rpm' or 'binary' exiting" << endl; + cerr << "Invalid " + company + " Package Type Arugument entered, use 'rpm' or 'binary' exiting" << endl; exit(1); } } @@ -263,9 +291,9 @@ int main(int argc, char *argv[]) cout << endl; if ( systemPackage == "*.x86_64.rpm" ) - prompt = "Are you sure you want to install the '" + release + "' InfiniDB RPM on '" + systemName + "' ? (y,n,exit) > "; + prompt = "Are you sure you want to install the '" + release + "' " + company + " RPM on '" + systemName + "' ? (y,n,exit) > "; else - prompt = "Are you sure you want to install the '" + release + "/packages' InfiniDB Binary Package on '" + systemName + "' ? (y,n,exit) > "; + prompt = "Are you sure you want to install the '" + release + "/packages' " + company + " Binary Package on '" + systemName + "' ? (y,n,exit) > "; pcommand = readline(prompt.c_str()); if (!pcommand) @@ -310,7 +338,7 @@ int main(int argc, char *argv[]) //remove all calpont packages from local /root/ directory, can interfere with install if (geteuid() == 0) - system("rm -f /root/calpont-*rpm /root/infinidb-*rpm"); + system("rm -f /root" + installLocation + "-*rpm /root/infinidb-*rpm /root/mariadb-*rpm "); string systemDir = "systems/" + systemName + "/"; @@ -323,11 +351,8 @@ int main(int argc, char *argv[]) int idbver = -1; string currentPrefix; - string calpontPackagename; string mysqlRPMname; - //TODO: replace all the goofy file I/O with glob(3) or better yet just parse the output of samba 'dir' cmd - // and avoid all the wasted network I/O if ( systemPackage == "*.x86_64.rpm" ) { //get rpm @@ -343,7 +368,7 @@ int main(int argc, char *argv[]) else { //try to guess the release, v4+ takes precedence - string sentinel = systemDir + "infinidb-libs-*.rpm"; + string sentinel = systemDir + "" + calpontPackagename + "-libs-*.rpm"; glob_t gt; memset(>, 0, sizeof(gt)); idbver = 3; @@ -352,7 +377,6 @@ int main(int argc, char *argv[]) globfree(>); } - calpontPackagename = "infinidb"; mysqlRPMname = calpontPackagename + "-storage-engine"; //check if package is there @@ -361,8 +385,8 @@ int main(int argc, char *argv[]) int rtnCode = system(cmd.c_str()); if (rtnCode != 0) { { - cout << endl << "FAILED: InfiniDB Package(s) not found in " << release << " , exiting" << endl; - cerr << endl << "FAILED: InfiniDB Package(s) not found in " << release << " , exiting" << endl; + cout << endl << "FAILED: " + company + " Package(s) not found in " << release << " , exiting" << endl; + cerr << endl << "FAILED: " + company + " Package(s) not found in " << release << " , exiting" << endl; exit(1); } } @@ -377,7 +401,8 @@ int main(int argc, char *argv[]) buf = line; string::size_type pos; - pos = buf.find("infinidb-storage-engine-",0); + string package = calpontPackagename + "-storage-engine-"; + pos = buf.find(package,0); if (pos != string::npos) { currentPrefix = buf.substr(pos+24,1); break; @@ -387,7 +412,7 @@ int main(int argc, char *argv[]) calpontPackage = calpontPackagename + "-" + currentPrefix + systemPackage; - cout << endl << "Using the InfiniDB Packages '" + systemPackage + "' from " + SHARED + "/packages/" + release + "/" << endl; + cout << endl << "Using the " + company + " Packages '" + systemPackage + "' from " + SHARED + "/packages/" + release + "/" << endl; } else //binary package { @@ -403,7 +428,7 @@ int main(int argc, char *argv[]) else { //try to guess the release, v4+ takes precedence - string sentinel = systemDir + "infinidb-ent-*.tar.gz"; + string sentinel = systemDir + "" + calpontPackagename + "-ent-*.tar.gz"; glob_t gt; memset(>, 0, sizeof(gt)); idbver = 3; @@ -413,9 +438,8 @@ int main(int argc, char *argv[]) } currentPrefix = oam.itoa(idbver); - calpontPackagename = "infinidb"; mysqlRPMname = calpontPackagename + "-storage-engine"; - calpontPackage = "infinidb-ent-" + systemPackage; + calpontPackage = "" + calpontPackagename + "-ent-" + systemPackage; //check if package is there cmd = "ls " + systemDir + calpontPackage + " > /tmp/package.txt 2>&1"; @@ -423,8 +447,8 @@ int main(int argc, char *argv[]) int rtnCode = system(cmd.c_str()); if (rtnCode != 0) { { - cout << endl << "FAILED: InfiniDB binary package not found in " << release << ", exiting" << endl; - cerr << endl << "FAILED: InfiniDB binary package not found in " << release << ", exiting" << endl; + cout << endl << "FAILED: " + company + " binary package not found in " << release << ", exiting" << endl; + cerr << endl << "FAILED: " + company + " binary package not found in " << release << ", exiting" << endl; exit(1); } } @@ -439,7 +463,8 @@ int main(int argc, char *argv[]) buf = line; string::size_type pos; - pos = buf.find("infinidb-ent-",0); + string package = calpontPackagename + "-ent-" + pos = buf.find(package,0); if (pos != string::npos) { currentPrefix = buf.substr(pos+13,1); break; @@ -447,7 +472,7 @@ int main(int argc, char *argv[]) } file.close(); - cout << endl << "Using the InfiniDB Package '" + systemPackage + "' from " + SHARED + "/Iterations/" + release + "/packages" << endl; + cout << endl << "Using the " + company + " Package '" + systemPackage + "' from " + SHARED + "/Iterations/" + release + "/packages" << endl; } @@ -519,14 +544,14 @@ exit(0); cout << "Get System Calpont.xml " << flush; for ( int retry = 0 ; retry < 5 ; retry++ ) { - cmd = "./remote_scp_get.sh " + installParentModuleIPAddr + " " + password + " " + installDir + "/Calpont/etc/Calpont.xml " + systemUser + " " + debug_flag; + cmd = "./remote_scp_get.sh " + installParentModuleIPAddr + " " + password + " " + installDir + "" + installLocation + "/etc" + installLocation + ".xml " + systemUser + " " + debug_flag; rtnCode = system(cmd.c_str()); sleep(2); if (rtnCode == 0) { cmd = "mv Calpont.xml " + systemDir + "/."; rtnCode = system(cmd.c_str()); if ( rtnCode == 0 ) { - //Calpont.xml found + /" + installLocation + ".xml found //try to parse it Config* sysConfigOld; @@ -540,7 +565,7 @@ exit(0); // redirect cout to /dev/null cerr.rdbuf(file.rdbuf()); - sysConfigOld = Config::makeConfig( systemDir + "/Calpont.xml"); + sysConfigOld = Config::makeConfig( systemDir + "" + installLocation + ".xml"); // restore cout stream buffer cerr.rdbuf (strm_buffer); @@ -573,10 +598,10 @@ exit(0); RPMSAVE: //try Calpont.xml.rpmsave cout << "Get System Calpont.xml.rpmsave " << flush; - cmd = "./remote_scp_get.sh " + installParentModuleIPAddr + " " + password + " " + installDir + "/Calpont/etc/Calpont.xml.rpmsave " + systemUser + " " + debug_flag; + cmd = "./remote_scp_get.sh " + installParentModuleIPAddr + " " + password + " " + installDir + "" + installLocation + "/etc" + installLocation + ".xml.rpmsave " + systemUser + " " + debug_flag; rtnCode = system(cmd.c_str()); if (rtnCode == 0) { - cmd = "mv Calpont.xml.rpmsave " + systemDir + "/Calpont.xml"; + cmd = "mv Calpont.xml.rpmsave " + systemDir + "" + installLocation + ".xml"; rtnCode = system(cmd.c_str()); if ( rtnCode != 0 ) { cout << "ERROR: No system Calpont.xml or Calpont.xml.rpmsave found, exiting" << endl; @@ -606,7 +631,7 @@ CONFIGDONE: Config* sysConfigOld; try { - sysConfigOld = Config::makeConfig( systemDir + "/Calpont.xml"); + sysConfigOld = Config::makeConfig( systemDir + "" + installLocation + ".xml"); } catch(...) { @@ -625,8 +650,8 @@ CONFIGDONE: } catch(...) { - cout << "ERROR: Problem updating the InfiniDB System Configuration file, exiting" << endl; - cerr << "ERROR: Problem updating the InfiniDB System Configuration file, exiting" << endl; + cout << "ERROR: Problem updating the " + company + " System Configuration file, exiting" << endl; + cerr << "ERROR: Problem updating the " + company + " System Configuration file, exiting" << endl; exit(1); } @@ -644,8 +669,8 @@ CONFIGDONE: } catch(...) { - cout << "ERROR: Problem reading serverTypeInstall from the InfiniDB System Configuration file, exiting" << endl; - cerr << "ERROR: Problem reading serverTypeInstall from the InfiniDB System Configuration file, exiting" << endl; + cout << "ERROR: Problem reading serverTypeInstall from the " + company + " System Configuration file, exiting" << endl; + cerr << "ERROR: Problem reading serverTypeInstall from the " + company + " System Configuration file, exiting" << endl; exit(1); } @@ -656,8 +681,8 @@ CONFIGDONE: } catch(...) { - cout << "ERROR: Problem reading DBRootStorageType from the InfiniDB System Configuration file, exiting" << endl; - cerr << "ERROR: Problem reading DBRootStorageType from the InfiniDB System Configuration file, exiting" << endl; + cout << "ERROR: Problem reading DBRootStorageType from the " + company + " System Configuration file, exiting" << endl; + cerr << "ERROR: Problem reading DBRootStorageType from the " + company + " System Configuration file, exiting" << endl; exit(1); } @@ -670,8 +695,8 @@ CONFIGDONE: } catch(...) { - cout << "ERROR: Problem reading DataFileEnvFile from the InfiniDB System Configuration file, exiting" << endl; - cerr << "ERROR: Problem reading DataFileEnvFile from the InfiniDB System Configuration file, exiting" << endl; + cout << "ERROR: Problem reading DataFileEnvFile from the " + company + " System Configuration file, exiting" << endl; + cerr << "ERROR: Problem reading DataFileEnvFile from the " + company + " System Configuration file, exiting" << endl; exit(1); } } @@ -736,15 +761,7 @@ CONFIGDONE: cout << "Shutdown System " << flush; - cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '" + installDir + "/Calpont/bin/mcsadmin shutdownsystem Force y' 'Successful shutdown' Error 60 " + debug_flag; - rtnCode = system(cmd.c_str()); - if (rtnCode == 0) - cout << "DONE" << endl; - - // run calpontUninstaller script - cout << "Run calpontUninstall script " << flush; - - cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '" + installDir + "/Calpont/bin/calpontUninstall.sh -d -p " + password + "' 'Uninstall Completed' FAILED 500 " + debug_flag; + cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '" + installDir + "" + installLocation + "/bin/" + adminCommand + " shutdownsystem Force y' 'Successful shutdown' Error 60 " + debug_flag; rtnCode = system(cmd.c_str()); if (rtnCode == 0) cout << "DONE" << endl; @@ -756,7 +773,7 @@ CONFIGDONE: installer = "parent_binary_installer.sh"; cmd = "cd " + systemDir + ";../../" + installer + " " + installParentModuleIPAddr + " " + password + " " + systemPackage + " " + release + " " + configFile + " " + systemUser + " " + - installDir + " " + debug_flag; + installDir + " " + calpontPackagename + " " + installLocation + " " + debug_flag; } else { @@ -764,14 +781,14 @@ CONFIGDONE: { installer = "dm_parent_installer.sh"; cmd = "cd " + systemDir + ";../../" + installer + " " + installParentModuleIPAddr + " " + - password + " " + systemPackage + " " + release + " " + configFile + " " + systemUser + " " + CE + " " + debug_flag; + password + " " + systemPackage + " " + release + " " + configFile + " " + systemUser + " " + CE + " " + calpontPackagename + " " + installLocation + " " + debug_flag; } else { installer = "pm_parent_installer.sh"; cmd = "cd " + systemDir + ";../../" + installer + " " + installParentModuleIPAddr + " " + password + " " + systemPackage + " " + release + " " + configFile + " " + currentPrefix + " " + - systemUser + " " + debug_flag; + systemUser + " " + calpontPackagename + " " + installLocation + " " + debug_flag; } } @@ -790,22 +807,22 @@ CONFIGDONE: { if ( MySQLport == oam::UnassignedName ) { - cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '. " + installDir + "/Calpont/bin/" + DataFileEnvFile + ";" + installDir + "/Calpont/bin/postConfigure -i " + installDir + "/Calpont -n -p " + password + "' 'System is Active' Error 1200 " + debug_flag; + cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '. " + installDir + "" + installLocation + "/bin/" + DataFileEnvFile + ";" + installDir + "" + installLocation + "/bin/postConfigure -i " + installDir + "" + installLocation + " -u -p " + password + "' 'System is Active' Error 1200 " + debug_flag; } else { - cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '. " + installDir + "/Calpont/bin/" + DataFileEnvFile + ";" + installDir + "/Calpont/bin/postConfigure -i " + installDir + "/Calpont -n -p " + password + " -port " + MySQLport + "' 'System is Active' Error 1200 " + debug_flag; + cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '. " + installDir + "" + installLocation + "/bin/" + DataFileEnvFile + ";" + installDir + "" + installLocation + "/bin/postConfigure -i " + installDir + "" + installLocation + " -u -p " + password + " -port " + MySQLport + "' 'System is Active' Error 1200 " + debug_flag; } } else { if ( MySQLport == oam::UnassignedName ) { - cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '" + installDir + "/Calpont/bin/postConfigure -i " + installDir + "/Calpont -n -p " + password + "' 'System is Active' Error 1200 " + debug_flag; + cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '" + installDir + "" + installLocation + "/bin/postConfigure -i " + installDir + "" + installLocation + " -u -p " + password + "' 'System is Active' Error 1200 " + debug_flag; } else { - cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '" + installDir + "/Calpont/bin/postConfigure -i " + installDir + "/Calpont -n -p " + password + " -port " + MySQLport + "' 'System is Active' Error 1200 " + debug_flag; + cmd = "./remote_command.sh " + installParentModuleIPAddr + " " + systemUser + " " + password + " '" + installDir + "" + installLocation + "/bin/postConfigure -i " + installDir + "" + installLocation + " -u -p " + password + " -port " + MySQLport + "' 'System is Active' Error 1200 " + debug_flag; string DataFileEnvFile = "setenv-hdfs-20"; } } diff --git a/tools/configMgt/dm_parent_installer.sh b/tools/configMgt/dm_parent_installer.sh index 53e424483..48627505e 100755 --- a/tools/configMgt/dm_parent_installer.sh +++ b/tools/configMgt/dm_parent_installer.sh @@ -16,29 +16,25 @@ set RELEASE [lindex $argv 3] set CONFIGFILE [lindex $argv 4] set USERNAME [lindex $argv 5] set CEFLAG [lindex $argv 6] -set DEBUG [lindex $argv 7] +set PACKAGENAME [lindex $argv 7] +set INSTALLLOCATION [lindex $argv 8] +set DEBUG [lindex $argv 9] -set CALPONTPACKAGE1 infinidb-libs-$PACKAGE -set CALPONTPACKAGE2 infinidb-platform-$PACKAGE -if { $CEFLAG == "1" } { - set CALPONTPACKAGE3 " " -} else { - set CALPONTPACKAGE3 infinidb-enterprise-$PACKAGE -} -set MYSQLPACKAGE infinidb-storage-engine-$PACKAGE -set MYSQLDPACKAGE infinidb-mysql-$PACKAGE set INSTALLDIR "/usr/local" set SHARED "//srvhill01/shared" log_user $DEBUG spawn -noecho /bin/bash -#send "rm -f $CALPONTPACKAGE1 $CALPONTPACKAGE2 $CALPONTPACKAGE3\n" -# -# delete and erase all old packages from Director Module -# + +SET CONFIG "Calpont" +if { $PACKAGENAME != "NULL"} { + SET CONFIG "Calpont" +} + + set timeout 10 -send "ssh $USERNAME@$SERVER 'rm -f /root/calpont-*.rpm /root/infinidb*.rpm'\n" +send "ssh $USERNAME@$SERVER 'rm -f /root/$INSTALLLOCATION-*.rpm /root/infinidb*.rpm'\n" expect { -re "authenticity" { send "yes\n" expect { @@ -65,7 +61,7 @@ send "$PASSWORD\n" expect { -re {[$#] } { } } -send "ssh $USERNAME@$SERVER 'rpm -e --nodeps \$(rpm -qa | grep '^InfiniDB') >/dev/null 2>&1; rpm -e --nodeps \$(rpm -qa | grep '^infinidb-')'\n" +send "ssh $USERNAME@$SERVER 'rpm -e --nodeps \$(rpm -qa | grep '^mariadb-columnstore') >/dev/null 2>&1; rpm -e --nodeps \$(rpm -qa | grep '^infinidb-')'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" @@ -78,7 +74,7 @@ expect { -re "Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit -1 } } sleep 10 -send "ssh $USERNAME@$SERVER 'rm -f $INSTALLDIR/Calpont/releasenum >/dev/null 2>&1; test -x $INSTALLDIR/Calpont/bin/pre-uninstall && $INSTALLDIR/Calpont/bin/pre-uninstall'\n" +send "ssh $USERNAME@$SERVER 'rm -f $INSTALLDIR/$INSTALLLOCATION/releasenum >/dev/null 2>&1; test -x $INSTALLDIR/$INSTALLLOCATION/bin/pre-uninstall && $INSTALLDIR/$INSTALLLOCATION/bin/pre-uninstall'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" @@ -148,7 +144,7 @@ if { $CONFIGFILE != "NULL"} { # # copy over Calpont.xml file # - send "scp $CONFIGFILE $USERNAME@$SERVER:/usr/local/Calpont/etc/Calpont.xml\n" + send "scp $CONFIGFILE $USERNAME@$SERVER:/usr/local/$INSTALLLOCATION/etc/$CONFIG.xml\n" expect -re "word: " # send the password send "$PASSWORD\n" @@ -159,7 +155,7 @@ if { $CONFIGFILE != "NULL"} { -re "No such file or directory" { send_user "FAILED: Invalid package\n" ; exit -1 } } send_user "Copy InfiniDB Configuration File " - send "scp $CONFIGFILE $USERNAME@$SERVER:/usr/local/Calpont/etc/Calpont.xml.rpmsave\n" + send "scp $CONFIGFILE $USERNAME@$SERVER:/usr/local/$INSTALLLOCATION/etc/$CONFIG.xml.rpmsave\n" expect -re "word: " # send the password send "$PASSWORD\n" @@ -170,7 +166,7 @@ if { $CONFIGFILE != "NULL"} { -re "No such file or directory" { send_user "FAILED: Invalid package\n" ; exit -1 } } #do a dummy scp command - send "scp $CONFIGFILE $USERNAME@$SERVER:/tmp/Calpont.xml\n" + send "scp $CONFIGFILE $USERNAME@$SERVER:/tmp/$CONFIG.xml\n" expect -re "word: " # send the password send "$PASSWORD\n" @@ -182,7 +178,7 @@ if { $CONFIGFILE != "NULL"} { # rename previous installed config file # send_user "Copy RPM-saved InfiniDB Configuration File " - send "ssh $USERNAME@$SERVER 'cd /usr/local/Calpont/etc/;mv -f Calpont.xml Calpont.xml.install;cp -v Calpont.xml.rpmsave Calpont.xml'\n" + send "ssh $USERNAME@$SERVER 'cd /usr/local/$INSTALLLOCATION/etc/;mv -f Calpont.xml Calpont.xml.install;cp -v Calpont.xml.rpmsave Calpont.xml'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" diff --git a/tools/configMgt/parent_binary_installer.sh b/tools/configMgt/parent_binary_installer.sh index f982c2823..dc87420e6 100755 --- a/tools/configMgt/parent_binary_installer.sh +++ b/tools/configMgt/parent_binary_installer.sh @@ -15,7 +15,9 @@ set RELEASE [lindex $argv 3] set CONFIGFILE [lindex $argv 4] set USERNAME [lindex $argv 5] set INSTALLDIR [lindex $argv 6] -set DEBUG [lindex $argv 7] +set PACKAGENAME [lindex $argv 7] +set INSTALLLOCATION [lindex $argv 8] +set DEBUG [lindex $argv 9] set CALPONTPACKAGE infinidb-ent-*$PACKAGE @@ -24,7 +26,7 @@ set SHARED "//srvhill01/shared" set INSTALLDIRARG " " set HOME "/root" if { $USERNAME != "root" } { - set INSTALLDIRARG "--installdir=$INSTALLDIR/Calpont" + set INSTALLDIRARG "--installdir=$INSTALLDIR/$INSTALLLOCATION" set HOME $INSTALLDIR } @@ -36,7 +38,7 @@ send "rm -f $PACKAGE\n" # set timeout 30 send_user "Remove Calpont Packages from System " -send "ssh $USERNAME@$SERVER 'rm -f $INSTALLDIR/calpont*.gz;rm -f /root/calpont*.rpm;rm -f /root/calpont*.gz'\n" +send "ssh $USERNAME@$SERVER 'rm -f $INSTALLDIR/$INSTALLLOCATION*.gz;rm -f /root/$INSTALLLOCATION*.rpm;rm -f /root/$INSTALLLOCATION*.gz'\n" expect { -re "authenticity" { send "yes\n" expect { @@ -102,7 +104,7 @@ expect { -re "Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit -1 } } sleep 10 -send "ssh $USERNAME@$SERVER 'rm -f $INSTALLDIR/Calpont/releasenum >/dev/null 2>&1; test -x $INSTALLDIR/Calpont/bin/pre-uninstall && $INSTALLDIR/Calpont/bin/pre-uninstall $INSTALLDIRARG'\n" +send "ssh $USERNAME@$SERVER 'rm -f $INSTALLDIR/$INSTALLLOCATION/releasenum >/dev/null 2>&1; test -x $INSTALLDIR/$INSTALLLOCATION/bin/pre-uninstall && $INSTALLDIR/$INSTALLLOCATION/bin/pre-uninstall $INSTALLDIRARG'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" @@ -120,7 +122,7 @@ sleep 5 # set timeout 30 send_user "Install New Calpont Package " -send "ssh $USERNAME@$SERVER 'tar -C $INSTALLDIR --exclude db -zxf $HOME/$CALPONTPACKAGE;cat $INSTALLDIR/Calpont/releasenum'\n" +send "ssh $USERNAME@$SERVER 'tar -C $INSTALLDIR --exclude db -zxf $HOME/$CALPONTPACKAGE;cat $INSTALLDIR/$INSTALLLOCATION/releasenum'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" @@ -142,7 +144,7 @@ send "rm -f $PACKAGE\n" send_user "Run post-install script " send " \n" send date\n -send "ssh $USERNAME@$SERVER '$INSTALLDIR/Calpont/bin/post-install $INSTALLDIRARG'\n" +send "ssh $USERNAME@$SERVER '$INSTALLDIR/$INSTALLLOCATION/bin/post-install $INSTALLDIRARG'\n" set timeout 10 expect { -re "word: " { send "$PASSWORD\n" } abort @@ -165,10 +167,10 @@ sleep 10 # if { $CONFIGFILE != "NULL"} { # - # copy over Calpont.xml file + # copy over $CONFIG.xml file # send_user "Copy Calpont Configuration File " - send "scp $CONFIGFILE $USERNAME@$SERVER:$INSTALLDIR/Calpont/etc/Calpont.xml.rpmsave\n" + send "scp $CONFIGFILE $USERNAME@$SERVER:$INSTALLDIR/$INSTALLLOCATION/etc/$CONFIG.xml.rpmsave\n" expect -re "word: " # send the password send "$PASSWORD\n" @@ -180,7 +182,7 @@ if { $CONFIGFILE != "NULL"} { -re "Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit -1 } -re "No such file or directory" { send_user "FAILED: Invalid package\n" ; exit -1 } } - send "scp $CONFIGFILE $USERNAME@$SERVER:$INSTALLDIR/Calpont/etc/Calpont.xml\n" + send "scp $CONFIGFILE $USERNAME@$SERVER:$INSTALLDIR/$INSTALLLOCATION/etc/$CONFIG.xml\n" expect -re "word: " # send the password send "$PASSWORD\n" @@ -197,13 +199,13 @@ if { $CONFIGFILE != "NULL"} { # rename previous installed config file # send_user "Copy RPM-saved Calpont Configuration File " - send "ssh $USERNAME@$SERVER 'cd $INSTALLDIR/Calpont/etc/;mv -f Calpont.xml Calpont.xml.install;cp -v Calpont.xml.rpmsave Calpont.xml'\n" + send "ssh $USERNAME@$SERVER 'cd $INSTALLDIR/$INSTALLLOCATION/etc/;mv -f $CONFIG.xml $CONFIG.xml.install;cp -v $CONFIG.xml.rpmsave $CONFIG.xml'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" # check return expect { - -re "Calpont.xml" { send_user "DONE" } abort + -re "$CONFIG.xml" { send_user "DONE" } abort -re "Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit -1 } } } diff --git a/tools/configMgt/pm_parent_installer.sh b/tools/configMgt/pm_parent_installer.sh index 0cc574de3..a9e038c2e 100755 --- a/tools/configMgt/pm_parent_installer.sh +++ b/tools/configMgt/pm_parent_installer.sh @@ -17,24 +17,27 @@ set RELEASE [lindex $argv 3] set CONFIGFILE [lindex $argv 4] set PREFIX [lindex $argv 5] set USERNAME [lindex $argv 6] -set DEBUG [lindex $argv 7] +set PACKAGENAME [lindex $argv 7] +set INSTALLLOCATION [lindex $argv 8] +set DEBUG [lindex $argv 9] -set CALPONTPACKAGE1 infinidb-libs-$PREFIX$PACKAGE -set CALPONTPACKAGE2 infinidb-platform-$PREFIX$PACKAGE -set CALPONTPACKAGE3 infinidb-enterprise-$PREFIX$PACKAGE -set MYSQLPACKAGE infinidb-storage-engine-$PACKAGE -set MYSQLDPACKAGE infinidb-mysql-$PACKAGE set SHARED "//srvhill01/shared" set INSTALLDIR "/usr/local" log_user $DEBUG spawn -noecho /bin/bash + +SET CONFIG "Calpont" +if { $PACKAGENAME != "NULL"} { + SET CONFIG "Calpont" +} + send "rm -f $PACKAGE\n" # # delete and erase all old packages from Parent OAM Module # set timeout 30 -send "ssh $USERNAME@$SERVER 'rm -f /root/calpont-*.rpm /root/infinidb*.rpm'\n" +send "ssh $USERNAME@$SERVER 'rm -f /root/$INSTALLLOCATION-*.rpm /root/infinidb*.rpm /root/mariabd*.rpm '\n" expect { -re "authenticity" { send "yes\n" expect { @@ -82,7 +85,7 @@ send_user "\n" set timeout 60 expect -re {[$#] } send_user "Erase Old InfiniDB Package " -send "ssh $USERNAME@$SERVER 'rpm -e --nodeps \$(rpm -qa | grep '^InfiniDB') >/dev/null 2>&1; rpm -e --nodeps \$(rpm -qa | grep '^infinidb-')'\n" +send "ssh $USERNAME@$SERVER 'rpm -e --nodeps \$(rpm -qa | grep '^mariadb-columnstore') >/dev/null 2>&1; rpm -e --nodeps \$(rpm -qa | grep '^infinidb-')'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" @@ -94,7 +97,7 @@ expect { -re "Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit -1 } } sleep 10 -send "ssh $USERNAME@$SERVER 'rm -f $INSTALLDIR/Calpont/releasenum >/dev/null 2>&1; test -x $INSTALLDIR/Calpont/bin/pre-uninstall && $INSTALLDIR/Calpont/bin/pre-uninstall'\n" +send "ssh $USERNAME@$SERVER 'rm -f $INSTALLDIR/$INSTALLLOCATION/releasenum >/dev/null 2>&1; test -x $INSTALLDIR/$INSTALLLOCATION/bin/pre-uninstall && $INSTALLDIR/$INSTALLLOCATION/bin/pre-uninstall'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" @@ -131,7 +134,7 @@ expect -re {[$#] } send "rm -f $PACKAGE\n" # if { $CONFIGFILE != "NULL"} { - send "scp $CONFIGFILE $USERNAME@$SERVER:/usr/local/Calpont/etc/Calpont.xml\n" + send "scp $CONFIGFILE $USERNAME@$SERVER:/usr/local/$INSTALLLOCATION/etc/$CONFIG.xml\n" expect -re "word: " # send the password send "$PASSWORD\n" @@ -142,10 +145,10 @@ if { $CONFIGFILE != "NULL"} { -re "No such file or directory" { send_user "FAILED: Invalid package\n" ; exit -1 } } # - # copy over Calpont.xml file + # copy over $CONFIG.xml file # send_user "Copy InfiniDB Configuration File " - send "scp $CONFIGFILE $USERNAME@$SERVER:/usr/local/Calpont/etc/Calpont.xml.rpmsave\n" + send "scp $CONFIGFILE $USERNAME@$SERVER:/usr/local/$INSTALLLOCATION/etc/$CONFIG.xml.rpmsave\n" expect -re "word: " # send the password send "$PASSWORD\n" @@ -156,7 +159,7 @@ if { $CONFIGFILE != "NULL"} { -re "No such file or directory" { send_user "FAILED: Invalid package\n" ; exit -1 } } #do a dummy scp command - send "scp $CONFIGFILE $USERNAME@$SERVER:/tmp/Calpont.xml\n" + send "scp $CONFIGFILE $USERNAME@$SERVER:/tmp/$CONFIG.xml\n" expect -re "word: " # send the password send "$PASSWORD\n" @@ -168,13 +171,13 @@ if { $CONFIGFILE != "NULL"} { # rename previous installed config file # send_user "Copy RPM-saved InfiniDB Configuration File " - send "ssh $USERNAME@$SERVER 'cd /usr/local/Calpont/etc/;mv -f Calpont.xml Calpont.xml.install;cp -v Calpont.xml.rpmsave Calpont.xml'\n" + send "ssh $USERNAME@$SERVER 'cd /usr/local/$INSTALLLOCATION/etc/;mv -f $CONFIG.xml $CONFIG.xml.install;cp -v $CONFIG.xml.rpmsave $CONFIG.xml'\n" expect -re "word: " # password for ssh send "$PASSWORD\n" # check return expect { - -re "Calpont.xml" { send_user "DONE" } + -re "$CONFIG.xml" { send_user "DONE" } -re "Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit -1 } } }