[PATCH 6/6] Use ksdata to set default runlevel

Jesse Keating jkeating at redhat.com
Tue Nov 13 05:51:00 UTC 2012


This removes code duplicated in desktop.py, and will short circuit the
routine if the user has indicated that they want a graphical boot by way
of kickstart data.
---
 pyanaconda/packaging/__init__.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 0108f68..1186569 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -575,11 +575,14 @@ class Payload(object):
             log.error("systemd is not installed -- can't set default target")
             return
 
+        # If X was already requested we don't have to continue
+        if self.data.xconfig.startX:
+            return
+
         try:
             import rpm
         except ImportError:
-            log.info("failed to import rpm -- defaulting to multi-user.target")
-            default_target = "multi-user.target"
+            log.info("failed to import rpm -- not adjusting default runlevel")
         else:
             ts = rpm.TransactionSet(ROOT_PATH)
 
@@ -587,14 +590,9 @@ class Payload(object):
             if ts.dbMatch("provides", 'service(graphical-login)').count() and \
                ts.dbMatch('provides', 'xorg-x11-server-Xorg').count() and \
                not flags.usevnc:
-                default_target = "graphical.target"
-            else:
-                default_target = "multi-user.target"
-
-        symlink_path = ROOT_PATH + '/etc/systemd/system/default.target'
-        if os.path.islink(symlink_path):
-            os.unlink(symlink_path)
-        os.symlink('/usr/lib/systemd/system/' + default_target, symlink_path)
+                # We only manipulate the ksdata.  The symlink is made later
+                # during the config write out.
+                self.data.xconfig.startX = True
 
     def dracutSetupArgs(self):
         args = []
-- 
1.7.11.4



More information about the anaconda-patches mailing list