[PATCH 14/15] Start DBus and HAL on anaconda startup if needed.

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

 



---
 anaconda |   49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/anaconda b/anaconda
index 4bbdfc5..2e1a175 100755
--- a/anaconda
+++ b/anaconda
@@ -27,7 +27,7 @@
 
 # This toplevel file is a little messy at the moment...
 
-import sys, os, re
+import sys, os, re, time, subprocess
 from optparse import OptionParser
 
 # keep up with process ID of miniwm if we start it
@@ -38,6 +38,30 @@ miniwm_pid = None
 def AnacondaShowWarning(message, category, filename, lineno, file=sys.stderr):
     log.warning("%s" % warnings.formatwarning(message, category, filename, lineno))
 
+# start DBus
+def startDBus():
+    path = "/bin/dbus-daemon"
+    if not os.access(path, os.X_OK):
+        path = "/usr/bin/dbus-daemon"
+    if not os.access(path, os.X_OK):
+        return None
+    fd = open("/dev/null","rw")
+    try:
+        pid = subprocess.Popen([path,"--system"], stdin = fd, stdout = fd, stderr = fd, close_fds = True).pid
+    except OSError:
+        return None
+    return pid
+
+def startHal(root='/'):
+    if not os.access("/usr/sbin/hald", os.X_OK):
+        return None
+    fd = open("/dev/null","rw")
+    try:
+        pid = subprocess.Popen(["/usr/sbin/hald","--use-syslog","--verbose=yes"], stdin = fd, stdout = fd, stderr = fd, close_fds = True).pid
+    except OSError:
+        return None
+    return pid
+
 # start miniWM
 def startMiniWM(root='/'):
     (rd, wr) = os.pipe()
@@ -655,6 +679,29 @@ if __name__ == "__main__":
         except:
             pass
 
+    # setup dbus, hal, if necessary
+    if not flags.test:
+        import dbus
+
+        try:
+            bus = dbus.SystemBus()
+        except dbus.exceptions.DBusException:
+            log.info("Starting message bus...")
+            pid = startDBus()
+            if not pid:
+                log.error("Unable to start message bus")
+            time.sleep(5)
+            bus = dbus.SystemBus()
+
+        try:
+            halobj = bus.get_object("org.freedesktop.Hal","/org/freedesktop/Hal/Manager")
+        except dbus.exceptions.DBusException:
+            log.info("Starting HAL daemon...")
+            pid = startHal()
+            if not pid:
+                log.error("Unable to start HAL daemon")
+            time.sleep(5)
+
     #
     # must specify install, rescue mode
     #
-- 
1.5.3.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux