[PATCH] Set the selinux state from the command line (#784828)

David Shea dshea at redhat.com
Mon Apr 14 16:55:46 UTC 2014


It turns out that we forgot to actually do anything with this command
line option. Change SELINUX_DEFAULT to -1 so that we can tell the
difference between nothing requested and SELINUX_ENFORCING explicitly
requested, so that we don't override kickstart settings in the former
case.
---
 anaconda                | 5 +++++
 pyanaconda/constants.py | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/anaconda b/anaconda
index c327f6d..33dbb30 100755
--- a/anaconda
+++ b/anaconda
@@ -1075,6 +1075,11 @@ if __name__ == "__main__":
         else:
             log.error("Unknown method: %s", anaconda.methodstr)
 
+    # Override the selinux state from kickstart if set on the command line
+    from pyanaconda.constants import SELINUX_DEFAULT
+    if flags.selinux != SELINUX_DEFAULT:
+        ksdata.selinux.selinux = flags.selinux
+
     from pyanaconda import localization
     # Set the language before loading an interface, when it may be too late.
 
diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
index 2b68865..b6889d7 100644
--- a/pyanaconda/constants.py
+++ b/pyanaconda/constants.py
@@ -24,7 +24,8 @@ from pyanaconda.i18n import N_
 
 import os
 
-SELINUX_DEFAULT = 1
+# Use -1 to indicate that the selinux configuration is unset
+SELINUX_DEFAULT = -1
 
 # where to look for 3rd party addons
 ADDON_PATHS = ["/usr/share/anaconda/addons"]
-- 
1.9.0



More information about the anaconda-patches mailing list