Change tftp to run standalone instead of xinetd slave to fix various limitations of the xinetd approach

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11870 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2012-03-15 15:19:40 +00:00
parent 8e7a0f2475
commit 6d92251583

View File

@ -1414,10 +1414,10 @@ sub enable_TFTPhpa
} else {
push @newcfgfile, $_;
}
} elsif (/^\s*disable\s*=/ && !/^\s*disable\s*=\s*no/) {
} elsif (/^\s*disable\s*=/ && !/^\s*disable\s*=\s*yes/) {
# enable the tftp by handling the entry 'disable = xx'
my $newcfg = $_;
$newcfg =~ s/=.*$/= no/;
$newcfg =~ s/=.*$/= yes/;
push @newcfgfile, $newcfg;
$recfg = 1;
} else {
@ -1445,15 +1445,44 @@ sub enable_TFTPhpa
}
print FILE @newcfgfile;
close (FILE);
# start xinetd
my $rc = xCAT::Utils->startService("xinetd");
if ($rc != 0)
{
xCAT::MsgUtils->message("S", " Failed to start xinetd.");
return 1;
my @output = xCAT::Utils->runcmd("service xinetd status", -1);
if ($::RUNCMD_RC == 0) {
if (grep(/running/, @output))
{
print ' '; # indent service output to separate it from the xcatd service output
system "service xinetd stop";
if ($? > 0)
{ # error
xCAT::MsgUtils->message("S",
"Error on command: service xinetd stop\n");
}
system "service xinetd start";
if ($? > 0)
{ # error
xCAT::MsgUtils->message("S",
"Error on command: service xinetd start\n");
return 1;
}
return 0;
}
}
xCAT::MsgUtils->message("S", " The tftp-hpa has been reconfigured.");
# /usr/sbin/in.tftpd -V
# tftp-hpa 0.49, with remap, with tcpwrappers
#
system("/usr/sbin/in.tftpd -v -l -s /tftpboot -m /etc/tftpmapfile4xcat.conf");
# start xinetd
#my $rc = xCAT::Utils->startService("xinetd");
#if ($rc != 0)
#{
# xCAT::MsgUtils->message("S", " Failed to start xinetd.");
# return 1;
#}
#xCAT::MsgUtils->message("S", " The tftp-hpa has been reconfigured.");
}
return 0;