From bb240e7708cdcb82e0673161ec9b87b05d757790 Mon Sep 17 00:00:00 2001 From: nott Date: Fri, 25 Jan 2008 17:40:04 +0000 Subject: [PATCH] Allow prompting from certificate setup scripts. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@327 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/sbin/xcatconfig | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/xCAT-server-2.0/sbin/xcatconfig b/xCAT-server-2.0/sbin/xcatconfig index 069bd0aec..eca14e1b4 100644 --- a/xCAT-server-2.0/sbin/xcatconfig +++ b/xCAT-server-2.0/sbin/xcatconfig @@ -372,25 +372,24 @@ if (( ! -r "/etc/xcat/policy.sqlite" ) || $::FORCE) { # set up the certificates for xcatd # if (( ! -d "/etc/xcat/ca" ) || $::FORCE) { - - xCAT::MsgUtils->message('I', "Running $::XCATROOT/share/xcat/scripts/setup-xcat-ca.sh.\n"); - my $cmd = "yes | $::XCATROOT/share/xcat/scripts/setup-xcat-ca.sh 'xCAT CA'"; - my $outref = xCAT::Utils->runcmd("$cmd", 0); - if ($::RUNCMD_RC != 0) + xCAT::MsgUtils->message('I', "\nSetting up basic certificates. Respond with a \'y\' when prompted.\n\n"); + my $cmd = "$::XCATROOT/share/xcat/scripts/setup-xcat-ca.sh 'xCAT CA'"; + xCAT::MsgUtils->message('I', "Running $cmd\n"); + my $rc = system($cmd); + if ($rc >> 8) { xCAT::MsgUtils->message('E', "Could not create xCAT certificate in /etc/xcat/ca.\n"); } else { xCAT::MsgUtils->message('I', "Created xCAT certificate.\n"); } - } if (( ! -d "/etc/xcat/cert" ) || $::FORCE) { - xCAT::MsgUtils->message('I', "Running $::XCATROOT/share/xcat/scripts/setup-server-cert.sh.\n"); - my $cmd = "yes | $::XCATROOT/share/xcat/scripts/setup-server-cert.sh `hostname`"; - my $outref = xCAT::Utils->runcmd("$cmd", 0); - if ($::RUNCMD_RC != 0) + my $cmd = "$::XCATROOT/share/xcat/scripts/setup-server-cert.sh $hname"; + xCAT::MsgUtils->message('I', "Running $cmd\n"); + my $rc = system($cmd); + if ($rc >> 8) { xCAT::MsgUtils->message('E', "Could not create xCAT certificate in /etc/xcat/cert.\n"); } else { @@ -400,10 +399,10 @@ if (( ! -d "/etc/xcat/cert" ) || $::FORCE) { if ( ( ! -r "$::root/.xcat/client-key.pem") || $::FORCE){ - xCAT::MsgUtils->message('I', "Running $::XCATROOT/share/xcat/scripts/setup-local-client.sh.\n"); - my $cmd = "yes | $::XCATROOT/share/xcat/scripts/setup-local-client.sh root"; - my $outref = xCAT::Utils->runcmd("$cmd", 0); - if ($::RUNCMD_RC != 0) + my $cmd = "$::XCATROOT/share/xcat/scripts/setup-local-client.sh root"; + xCAT::MsgUtils->message('I', "Running $cmd\n"); + my $rc = system($cmd); + if ($rc >> 8) { xCAT::MsgUtils->message('E', "Could not create xCAT certificate in /.xcat/client-key.pem.\n"); } else {