From 69684fce04ed626fd986708d3e552e75c671075f Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 17 Aug 2012 11:40:56 +0000 Subject: [PATCH] defect 3414740 Merge aixremoteshell/remoteshell git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13545 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/aixremoteshell | 21 ++++++++++++++++++++- xCAT/postscripts/remoteshell | 10 +++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/xCAT/postscripts/aixremoteshell b/xCAT/postscripts/aixremoteshell index 150439c00..f81d46cbe 100755 --- a/xCAT/postscripts/aixremoteshell +++ b/xCAT/postscripts/aixremoteshell @@ -12,6 +12,12 @@ login with no password. The default is /bin/rsh and /bin/rcp but can be overriden by setting the useSSHonAIX attribute in the site table to yes, in which case we will use ssh/scp. + The aixremoteshell postscripts will be called from remoteshell postscript + when on an AIX node. It will input a -d ( for do) flag, to indicate to run + If the flag is not input, the routine will do nothing. This is to have only + remoteshell in the postscripts table whether supporting AIX or Linux, + and better support mixed clusters. + =cut #----------------------------------------------------------------------------- @@ -30,7 +36,7 @@ my $useSocketSSL=eval { require IO::Socket::SSL; }; if ($useSocketSSL) { require IO::Socket::SSL; } - +use Getopt::Long; my $rc = 0; # Override from site table @@ -42,7 +48,20 @@ my $enablesshbetweennodes = $ENV{'ENABLESSHBETWEENNODES'}; my $msg; my $home; my $cmd; +my $runscript; my $username = "root"; +Getopt::Long::Configure("bundling"); +Getopt::Long::Configure("pass_through"); +GetOptions( + 'd|do' => \$runscript +); +# the postscript only runs if called with -d flag from remoteshell +unless ($runscript) { + my $msg = "aixremoteshell called without -d flag, do nothing."; + `logger -t xcat -p local4.err $msg`; + exit 0; +} + my @root = split ':', (`/bin/grep ^$username /etc/passwd 2>&1`); $home = $root[5]; # root home directory must be root system diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index acf8aa74a..3bb02ffdf 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -1,12 +1,16 @@ #!/bin/sh # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -#egan@us.ibm.com #(C)IBM Corp # -# Linux or AIX +# Linux or if AIX call aixremoteshell -d +if [ "$(uname -s)" = "AIX" ]; then + ./aixremoteshell -d 2>&1 + logger -t xcat -p local4.info "Install: On AIX , remoteshell calling aixremoteshell -d " + exit 0 +fi if [ -r /etc/ssh/sshd_config ] then - logger -t xcat -p local4.info "Install: setup /etc/ssh/sshd_config" + logger -t xcat -p local4.info "Install: setup /etc/ssh/sshd_config" cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIG sed -i 's/^X11Forwarding .*$/X11Forwarding yes/' /etc/ssh/sshd_config sed -i 's/^KeyRegenerationInterval .*$/KeyRegenerationInterval 0/' /etc/ssh/sshd_config