[Fedora-livecd-list] imgcreate/creator.py

Warren Togami 砥上勇 wtogami at fedoraproject.org
Thu Sep 10 20:02:37 UTC 2009


 imgcreate/creator.py |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 0b80dc71f82f0a2ed24d01209fd2eb892a2c8135
Author: Warren Togami <wtogami at redhat.com>
Date:   Thu Sep 10 16:01:57 2009 -0400

    Properly clean up fake /selinux directory during teardown

diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 910c778..909f616 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -476,13 +476,18 @@ class ImageCreator(object):
         # if the system was running selinux clean up our lies
         if os.path.exists("/selinux/enforce"):
             for root, dirs, files in os.walk(self._instroot + "/selinux"):
-                if root == self._instroot + "/selinux":
-                    continue
-                try:
-                    os.unlink(root)
-                except OSError:
-                    pass
-
+                for name in files:
+                    try:
+                        os.remove(os.path.join(root, name))
+                    except OSError:
+                        pass
+                for name in dirs:
+                    if os.path.join(root, name) == self._instroot + "/selinux":
+                        continue
+                    try:
+                        os.rmdir(os.path.join(root, name))
+                    except OSError:
+                        pass
 
     def mount(self, base_on = None, cachedir = None):
         """Setup the target filesystem in preparation for an install.





More information about the livecd mailing list