From aee619921ca23a16d71ba004973faed172cc47f2 Mon Sep 17 00:00:00 2001 From: lissav <lissav@8638fb3e-16cb-4fca-ae20-7b5d299a9bcd> Date: Thu, 17 Mar 2011 16:56:48 +0000 Subject: [PATCH] add support for the site.databaseloc attribute to the db2 setup postscripts git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9077 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/db2install | 8 +++++++- xCAT/postscripts/odbcsetup | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/db2install b/xCAT/postscripts/db2install index d9231b303..0ff564581 100755 --- a/xCAT/postscripts/db2install +++ b/xCAT/postscripts/db2install @@ -72,6 +72,7 @@ $::hname = `hostname`; chomp $::hname; $::MN = $ENV{'MASTER'}; # as known by the node +$::databaseloc = $ENV{'DATABASELOC'}; # directory for db instance if ($::osname eq 'AIX') { $::installdb2dir = "/opt/IBM/db2/V9.7"; # default @@ -520,8 +521,13 @@ sub rundb2sqlsetup close($cfgl); chomp $xcatcfg; my ($database, $instance, $password) = split('\|', $xcatcfg); - $cmd = + if ($::databaseloc) { + $cmd = + "DATABASELOC=$::databaseloc XCATDB2SERVER=$::MN XCATDB2PW=$password $::XCATROOT/bin/db2sqlsetup -i -C"; + } else { + $cmd = "XCATDB2SERVER=$::MN XCATDB2PW=$password $::XCATROOT/bin/db2sqlsetup -i -C"; + } $msg = "db2install:Running Client setup. \"$::XCATROOT/bin/db2sqlsetup -i -C\"\n"; `logger -t xcat $msg`; diff --git a/xCAT/postscripts/odbcsetup b/xCAT/postscripts/odbcsetup index 05077eb9c..13acb51c7 100755 --- a/xCAT/postscripts/odbcsetup +++ b/xCAT/postscripts/odbcsetup @@ -48,7 +48,8 @@ chomp $::sdate; my $msg; - +# get location of database +$::databaseloc = $ENV{'DATABASELOC'}; # check the /etc/xcat/cfgloc file to see if MySQL or DB2 # if it is not here, error out my $dbname = xCAT::Utils->get_DBName; @@ -103,7 +104,11 @@ sub setupdb2odbc close($cfgl); chomp $xcatcfg; my ($database, $instance, $password) = split('\|', $xcatcfg); - $cmd = "$::XCATROOT/bin/db2sqlsetup -o -C"; + if ($::databaseloc) { + $cmd = "DATABASELOC=$::databaseloc $::XCATROOT/bin/db2sqlsetup -o -C"; + } else { + $cmd = "$::XCATROOT/bin/db2sqlsetup -o -C"; + } $msg = "odbcsetup: Running Client ODBC setup. \"$cmd\"\n"; `logger -t xcat $msg`;