2008-05-21 16:29:16 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
{
|
|
|
|
$::XCATROOT =
|
|
|
|
$ENV{'XCATROOT'} ? $ENV{'XCATROOT'}
|
|
|
|
: -d '/opt/xcat' ? '/opt/xcat'
|
|
|
|
: '/usr';
|
|
|
|
}
|
|
|
|
use lib "$::XCATROOT/lib/perl";
|
|
|
|
use File::Basename;
|
|
|
|
use Getopt::Long;
|
|
|
|
use xCAT::MsgUtils;
|
|
|
|
use xCAT::Utils;
|
|
|
|
my $bname = basename($0);
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
=head1 copycerts
|
|
|
|
|
|
|
|
This updates the service node with files necessary to access the
|
|
|
|
database on the MasterNode and restarts the xcat daemon
|
|
|
|
run from servicenode postinstall script
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
©CertstoSN;
|
|
|
|
|
|
|
|
exit 0;
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
=head3 copyCertstoSN
|
|
|
|
|
|
|
|
Copy from the mounted /xcatpost/ directory to the MS /install/postscripts
|
|
|
|
directory the /install/postscripts/ca install/postscripts/cert and
|
|
|
|
/install/postscripts/_xcat into the local file system. These certificate are
|
2008-10-09 15:28:47 +00:00
|
|
|
needed for the postresql and mysql db setup for the service node
|
|
|
|
to be able to access
|
2008-05-21 16:29:16 +00:00
|
|
|
the DB from the service node.
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
sub copyCertstoSN
|
|
|
|
{
|
|
|
|
my $rc = 0;
|
|
|
|
`touch /etc/xCATSN`;
|
2008-10-09 14:11:52 +00:00
|
|
|
# get roots home directory
|
|
|
|
my $homedir=xCAT::Utils->getHomeDir();
|
2008-05-21 16:29:16 +00:00
|
|
|
if (-d "/xcatpost/_xcat")
|
|
|
|
{
|
2008-10-09 14:11:52 +00:00
|
|
|
if (!(-d "$homedir/.xcat"))
|
2008-05-21 16:29:16 +00:00
|
|
|
{
|
2008-10-09 14:11:52 +00:00
|
|
|
`mkdir -p $homedir/.xcat`;
|
|
|
|
`chmod 0600 $homedir/.xcat`;
|
2008-05-21 16:29:16 +00:00
|
|
|
}
|
2008-10-09 14:11:52 +00:00
|
|
|
`cp -f -rp /xcatpost/_xcat/* $homedir/.xcat`;
|
|
|
|
`chmod 0600 $homedir/.xcat/*`;
|
2008-05-21 16:29:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xCAT::MsgUtils->message('S',
|
|
|
|
"/xcatpost/_xcat directory does not exist\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (-d "/xcatpost/ca")
|
|
|
|
{
|
|
|
|
if (!(-d "/etc/xcat"))
|
|
|
|
{
|
|
|
|
mkdir("/etc/xcat", 0755);
|
|
|
|
}
|
|
|
|
if (!(-d "/etc/xcat/ca"))
|
|
|
|
{
|
|
|
|
mkdir("/etc/xcat/ca", 0755);
|
|
|
|
}
|
|
|
|
`cp -f -rp /xcatpost/ca/* /etc/xcat/ca`;
|
|
|
|
`chmod 0600 /etc/xcat/ca/*`;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xCAT::MsgUtils->message('S', "/xcatpost/ca directory does not exist\n");
|
|
|
|
|
|
|
|
}
|
2008-10-09 14:11:52 +00:00
|
|
|
if (xCAT::Utils->isAIX()) {
|
2010-04-23 18:07:58 +00:00
|
|
|
if (-d "/xcatpost/_xcat")
|
2008-10-09 14:11:52 +00:00
|
|
|
{
|
|
|
|
if (!(-d "/etc/xcat"))
|
|
|
|
{
|
|
|
|
mkdir("/etc/xcat", 0755);
|
|
|
|
}
|
|
|
|
if (!(-d "/etc/xcat/cert"))
|
|
|
|
{
|
|
|
|
mkdir("/etc/xcat/cert", 0755);
|
|
|
|
}
|
2009-03-16 12:44:30 +00:00
|
|
|
`cp -f -rp /xcatpost/_xcat/* /etc/xcat/cert`;
|
2008-10-09 14:11:52 +00:00
|
|
|
`chmod 0600 /etc/xcat/cert/*`;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-04-23 18:07:58 +00:00
|
|
|
xCAT::MsgUtils->message('S', "/xcatpost/_xcat directory does not exist\n");
|
2008-10-09 14:11:52 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-21 16:29:16 +00:00
|
|
|
return $rc;
|
|
|
|
}
|