summaryrefslogtreecommitdiffstats
path: root/flags.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2004-04-13 22:39:49 +0000
committerJeremy Katz <katzj@redhat.com>2004-04-13 22:39:49 +0000
commit07d25b40fa2041439795595115a703e4f00a1a7d (patch)
treef7e3fef1ca008c110ecc5dcf5cc62c4de7dd9497 /flags.py
parent4a7602c7d19f62a331f4e578ace4898ad1157ce8 (diff)
downloadanaconda-07d25b40fa2041439795595115a703e4f00a1a7d.tar.gz
anaconda-07d25b40fa2041439795595115a703e4f00a1a7d.tar.xz
anaconda-07d25b40fa2041439795595115a703e4f00a1a7d.zip
New Improved SELinux handling
* default in constants.py * 'selinux' flag will key it on (if off by default) * turn on for selinux=1, off for selinux=0 * non-existence of selinuxfs will force off
Diffstat (limited to 'flags.py')
-rw-r--r--flags.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/flags.py b/flags.py
index 1b63454f3..d101a0176 100644
--- a/flags.py
+++ b/flags.py
@@ -12,6 +12,7 @@
#
import os
+from constants import *
# A lot of effort, but it only allows a limited set of flags to be referenced
class Flags:
@@ -37,16 +38,26 @@ class Flags:
self.__dict__['flags']['autostep'] = 0
self.__dict__['flags']['autoscreenshot'] = 0
self.__dict__['flags']['usevnc'] = 0
- self.__dict__['flags']['selinux'] = 0
+ self.__dict__['flags']['selinux'] = SELINUX_DEFAULT
# determine if selinux is enabled or not
f = open("/proc/cmdline", "r")
line = f.readline()
f.close()
- if os.path.exists("/selinux/load") and line.find(" selinux=0") == -1:
- self.__dict__['flags']['selinux'] = 1
-
+ tokens = line.split()
+ for tok in tokens:
+ if tok == "selinux":
+ self.__dict__['flags']['selinux'] = 1
+ elif tok == "selinux=0":
+ self.__dict__['flags']['selinux'] = 0
+ elif tok == "selinux=1":
+ self.__dict__['flags']['selinux'] = 1
+
+ if not os.path.exists("/selinux/load"):
+ self.__dict__['flags']['selinux'] = 0
+
+
global flags
flags = Flags()