FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 12-05-2007, 10:24 PM
Bill Nottingham
 
Default Start DBus and HAL on anaconda startup if needed.

---
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 06:57 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org