fix for bug 4372, set selinux be in permissive mode for RHEL 7

This commit is contained in:
ligc 2013-11-26 16:49:09 +08:00
parent fea8c45131
commit baa3edb3ca

View File

@ -479,12 +479,24 @@ if ($::INITIALINSTALL || $::FORCE)
if ($rc == 0)
{
xCAT::MsgUtils->message('W', "SELINUX is not disabled, disabling it now...");
# Disable selinux for running system
my $cmd = "echo 0 > /selinux/enforce";
my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
# set selinux be in permissive mode for running system,
# if the user forgot to disable selinux,
# try to not hurt xcat too much
my $enforcefile;
if ( -f "/selinux/enforce")
{
xCAT::MsgUtils->message('E', "Failed to disable SELINUX.");
$enforcefile = "/selinux/enforce";
} elsif ( -f "/sys/fs/selinux/enforce" ) {
$enforcefile = "/sys/fs/selinux/enforce";
}
if ($enforcefile)
{
my $cmd = "echo 0 > $enforcefile";
my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message('E', "Failed to disable SELINUX.");
}
}
# Disable selinux through reboots
my $cmd = "sed -i 's/^SELINUX=.*\$/SELINUX=disabled/' /etc/selinux/config";