[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH] Remove as many of the /selinux path hardcodings as possible (#729563).



Ack

On 08/11/2011 09:41 AM, Chris Lumens wrote:
Convert the others to their proper new path.
---
  data/liveinst/liveinst         |    6 +++---
  pyanaconda/flags.py            |    3 ++-
  pyanaconda/rescue.py           |    4 ++--
  pyanaconda/storage/__init__.py |    4 ++--
  4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/data/liveinst/liveinst b/data/liveinst/liveinst
index a7c1a8e..930461f 100755
--- a/data/liveinst/liveinst
+++ b/data/liveinst/liveinst
@@ -80,12 +80,12 @@ fi

  export PATH=/sbin:/usr/sbin:$PATH

-if [ -x /usr/sbin/setenforce -a -e /selinux/enforce ]; then
-    current=$(cat /selinux/enforce)
+if [ -x /usr/sbin/getenforce ]; then
+    current=$(/usr/sbin/getenforce)
      /usr/sbin/setenforce 0
  fi

-if [ ! -e /selinux/load ]; then
+if [ -z "$(sestatus | grep enabled)" ]; then
      ANACONDA="$ANACONDA --noselinux"
  fi

diff --git a/pyanaconda/flags.py b/pyanaconda/flags.py
index 6d79dba..3871f47 100644
--- a/pyanaconda/flags.py
+++ b/pyanaconda/flags.py
@@ -18,6 +18,7 @@
  #

  import os
+import selinux
  import shlex
  from constants import *

@@ -116,7 +117,7 @@ class Flags:
          if self.__dict__['flags']['cmdline'].has_key("rpmarch"):
              self.__dict__['flags']['targetarch'] = self.__dict__['flags']['cmdline']['rpmarch']

-        if not os.path.exists("/selinux/load"):
+        if not selinux.is_selinux_enabled():
              self.__dict__['flags']['selinux'] = 0

  global flags
diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index 1e71dd6..af564e4 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -399,8 +399,8 @@ def doRescue(anaconda):
                      except StorageError:
                          log.error("Error enabling swap")

-                # and /selinux too
-                if flags.selinux and os.path.isdir("%s/selinux" %(anaconda.rootPath,)):
+                # and selinux too
+                if flags.selinux:
                      # we have to catch the possible exception
                      # because we support read-only mounting
                      try:
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index c177cbd..33f7e96 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1817,7 +1817,7 @@ class FSSet(object):
          if not self._selinux:
              self._selinux = NoDevice(format=getFormat("selinuxfs",
                                                        device="selinuxfs",
-                                                      mountpoint="/selinux"))
+                                                      mountpoint="/sys/fs/selinux"))
          return self._selinux

      @property
@@ -1877,7 +1877,7 @@ class FSSet(object):
                                        device=device.path,
                                        exists=True)
          elif mountpoint in ("/proc", "/sys", "/dev/shm", "/dev/pts",
-                            "/selinux", "/proc/bus/usb"):
+                            "/sys/fs/selinux", "/proc/bus/usb"):
              # drop these now -- we'll recreate later
              return None
          else:



--
David Cantrell <dcantrell redhat com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]