#!/usr/bin/env perl -w
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#####################################################
#
#   xCAT post script for AIX nodes
#
#               This script is run from the /etc/inittab file on both
#               diskless and diskfull AIX nodes
#
#               It is also run by the updatenode cmd ( -c 1) for -P
#                updatenode cmd ( -c 5)   for -k
#                 moncfg command (-c 3)
#               Install no arguments ( see aixinstall.pm)
#####################################################

# if AIX - make sure we include perl 5.8.2 in INC path.
#       Needed to find perl dependencies shipped in deps tarball.

#print "$::sdata xcataixpost: install the openssh and openssl\n";
`cd /xcatpost/packages; /usr/sbin/installp -aXYd . openssh.base  openssl.base  openssl.license openssh.msg.EN_US`;
if($? != 0)
{
    chomp($date = `/bin/date`);
    $msg = "$date installsshforvios: installing openssh failed!\n";
    `logger -t xcat -p local4.err $msg`;
}
else
{
    chomp($date = `/bin/date`);
    $msg = "$date installsshforvios: install openssh successfully!\n";
    `logger -t xcat -p local4.info $msg`;
}

#print "$::sdate xcataixpost: copy the public key from MN to vios\n";
`mkdir -p /home/padmin/.ssh/; cat /xcatpost/_ssh/authorized_keys >> /home/padmin/.ssh/authorized_keys2 2>&1`;
#print "$::sdate xcataixpost: xdsh -l padmin could logon automatically.\n";

`/xcatpost/remoteshell`;
