xcat-core/xCAT-server-2.0/sbin/copycerts
jbjohnso 5540ae512b -Change .directories in postscripts dir for wget traversal
-Change remoteshell to retrieve ssh host keys via credentials plugin
-Change allowcred.awk to be persistant in execution for multiple runs
-Move stunnel setup to the post.rh scripts (post.sles to do)
-Migrate to no longer have per-node postscripts generated for redhat installs
-Change to no longer use a postscripts tar file, recursive ftp instead
-Change to setup vsftpd



git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1238 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2008-04-30 20:54:57 +00:00

140 lines
3.3 KiB
Perl

#!/usr/bin/perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#egan@us.ibm.com
#(C)IBM Corp
#
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
#-----------------------------------------------------------------------------
&copyCertstoSN;
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
needed for the postresql db setup for the service node to be able to access
the DB from the service node.
=cut
#-----------------------------------------------------------------------------
sub copyCertstoSN
{
my $rc = 0;
`touch /etc/xCATSN`;
`touch /tmp/lissatestxxx`;
`unalias cp`;
if (-d "/xcatpost/_xcat")
{
if (!(-d "/root/.xcat"))
{
mkdir("/root/.xcat", 0600);
}
`cp -rp /xcatpost/_xcat/* /root/.xcat`;
`chmod 0600 /root/.xcat/*`;
}
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 -rp /xcatpost/ca/* /etc/xcat/ca`;
`chmod 0600 /etc/xcat/ca/*`;
`chmod 0600 /etc/xcat/ca/certs/*`;
}
else
{
xCAT::MsgUtils->message('S', "/xcatpost/ca directory does not exist\n");
}
if (-d "/xcatpost/cert")
{
if (!(-d "/etc/xcat"))
{
mkdir("/etc/xcat", 0755);
}
if (!(-d "/etc/xcat/cert"))
{
mkdir("/etc/xcat/cert", 0755);
}
`cp -rp /xcatpost/cert/* /etc/xcat/cert`;
`chmod 0600 /etc/xcat/cert/*`;
}
else
{
xCAT::MsgUtils->message('S',
"/xcatpost/cert directory does not exit\n");
}
if (-d "/xcatpost/etc/xcat") {
`cp /xcatpost/etc/xcat/cfgloc /etc/xcat/cfgloc`;
chmod 0600, "/etc/xcat/cfgloc";
}
else
{
xCAT::MsgUtils->message('S',
"/xcatpost/etc/xcat directory does not exit\n");
}
if (-d "/xcatpost/etc/sysconfig")
{
if (!(-d "/etc/sysconfig"))
{
mkdir("/etc/sysconfig", 0755);
}
`cp /xcatpost/etc/sysconfig/xcat /etc/sysconfig/xcat`;
chmod 0700, "/etc/sysconfig/xcat";
}
else
{
xCAT::MsgUtils->message('S',
"/xcatpost/etc/sysconfig directory does not exit\n");
}
# TODO fix for SuSE and AIX
`service xcatd restart`;
return $rc;
}