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

Jeremy Katz katzj at fedoraproject.org
Thu Apr 3 21:07:49 UTC 2008


 imgcreate/kickstart.py |   25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

New commits:
commit 7c1246ff21f5be35ef2ac470bd62378f079cb39e
Author: Jeremy Katz <katzj at redhat.com>
Date:   Thu Apr 3 16:57:28 2008 -0400

    Handle the fact that upstart doesn't use inittab

diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index 30156d8..ebee1b4 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -208,14 +208,23 @@ class ServicesConfig(KickstartConfig):
 class XConfig(KickstartConfig):
     """A class to apply a kickstart X configuration to a system."""
     def apply(self, ksxconfig):
-        if not ksxconfig.startX:
-            return
-        f = open(self.path("/etc/inittab"), "rw+")
-        buf = f.read()
-        buf = buf.replace("id:3:initdefault", "id:5:initdefault")
-        f.seek(0)
-        f.write(buf)
-        f.close()
+        if os.path.exists(self.path("/etc/inittab")) and ksxconfig.startX:
+            f = open(self.path("/etc/inittab"), "rw+")
+            buf = f.read()
+            buf = buf.replace("id:3:initdefault", "id:5:initdefault")
+            f.seek(0)
+            f.write(buf)
+            f.close()
+
+        # sigh.  with upstart, we no longer use inittab
+        if os.path.exists(self.path("/etc/sysconfig/init")) and not ksxconfig.startX:
+            f = open(self.path("/etc/sysconfig/init"), "rw+")
+            buf = f.read()
+            buf = buf.replace("GRAPHICAL=yes", "GRAPHICAL=no")
+            f.seek(0)
+            f.write(buf)
+            f.close()
+
 
 class NetworkConfig(KickstartConfig):
     """A class to apply a kickstart network configuration to a system."""





More information about the Fedora-livecd-list mailing list