Check if selinux is not in Enforcing mode (#824835)

Selinux causes problems for rpm scriptlets in the installroot.
This commit is contained in:
Martin Gracik 2012-05-29 11:01:18 +02:00
parent cd0b4458ba
commit 141a25801c

View File

@ -35,6 +35,7 @@ import os
import ConfigParser
import tempfile
import locale
import subprocess
from base import BaseLoraxClass, DataHolder
import output
@ -167,6 +168,17 @@ class Lorax(BaseLoraxClass):
logger.critical("no root privileges")
sys.exit(1)
# is selinux disabled?
logger.info("checking the selinux mode")
try:
seoutput = subprocess.check_output("/sbin/getenforce").strip()
except subprocess.CalledProcessError:
logger.error("could not get the selinux mode")
else:
if seoutput == "Enforcing":
logger.critical("selinux must be disabled or in Permissive mode")
sys.exit(1)
# do we have a proper yum base object?
logger.info("checking yum base object")
if not isinstance(ybo, yum.YumBase):