Check for selinux enforcing. Warn if it is.

This commit is contained in:
Jesse Keating 2007-12-03 11:40:41 -05:00 committed by Jesse Keating
parent 67df99833a
commit 33a2ec8508

10
pungi
View File

@ -19,6 +19,7 @@ import pypungi.pungi
import yum import yum
import pykickstart.parser import pykickstart.parser
import pykickstart.version import pykickstart.version
import subprocess
def main(): def main():
@ -31,6 +32,15 @@ def main():
print >> sys.stderr, "You must run pungi as root" print >> sys.stderr, "You must run pungi as root"
return 1 return 1
if opts.do_all or opts.do_buildinstall:
try:
selinux = subprocess.Popen('/usr/sbin/getenforce', stdout=subprocess.PIPE).communicate()[0].strip('\n')
if selinux == 'Enforcing':
print >> sys.stdout, "WARNING: SELinux is enforcing. This may lead to a compose with selinux disabled."
print >> sys.stdout, "Consider running with setenforce 0."
except:
pass
# Set up the kickstart parser and pass in the kickstart file we were handed # Set up the kickstart parser and pass in the kickstart file we were handed
ksparser = pykickstart.parser.KickstartParser(pykickstart.version.makeVersion()) ksparser = pykickstart.parser.KickstartParser(pykickstart.version.makeVersion())
ksparser.readKickstart(opts.config) ksparser.readKickstart(opts.config)