From 86d6fd80b301f40a72a591f8d9924fef78acbfdf Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 12 Mar 2013 12:37:12 +0000 Subject: [PATCH] add /opt/xcat/share/xcat/tools to the path for AIX git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15462 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatconfig | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 20ace79e8..d183100e1 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -231,14 +231,14 @@ if ($::INITIALINSTALL || $::FORCE || $::genSSHRootKeys) # # Update /etc/profile on AIX # -if ($::INITIALINSTALL) +if (($::INITIALINSTALL) ||($::UPDATEINSTALL)) { my $profname = "/etc/profile"; if ($::osname eq 'AIX') { my $cmd = qq~cat $profname | grep "XCATROOT"~; my $outref = xCAT::Utils->runcmd("$cmd", -1); - if ($::RUNCMD_RC != 0) + if ($::RUNCMD_RC != 0) # no xcat paths in the /etc/profile { # make back up file @@ -251,12 +251,25 @@ if ($::INITIALINSTALL) # add xCAT paths my $eccmd = - qq~echo '# xCAT setup\nXCATROOT=$::XCATROOT\nPATH=\$XCATROOT/bin:\$XCATROOT/sbin:\$PATH\nMANPATH=\$XCATROOT/share/man:\$MANPATH\nexport XCATROOT PATH MANPATH' >>$profname~; + qq~echo '# xCAT setup\nXCATROOT=$::XCATROOT\nPATH=\$XCATROOT/bin:\$XCATROOT/sbin:\$XCATROOT/share/xcat/tools:\$PATH\nMANPATH=\$XCATROOT/share/man:\$MANPATH\nexport XCATROOT PATH MANPATH' >>$profname~; $outref = xCAT::Utils->runcmd("$eccmd", 0); if ($::RUNCMD_RC != 0) { xCAT::MsgUtils->message('E', "Could not update $profname."); } + } else { # xcat path is there, maybe need to add /share/xcat/tools + my $cmd = qq~cat $profname | grep "/share/xcat/tools"~; + my $outref = xCAT::Utils->runcmd("$cmd", -1); + if ($::RUNCMD_RC != 0) # no tools paths in the /etc/profile + { + my $eccmd = + qq~echo 'PATH=\$XCATROOT/share/xcat/tools:\$PATH\nexport MANPATH' >>$profname~; + $outref = xCAT::Utils->runcmd("$eccmd", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message('E', "Could not update $profname."); + } + } } } }