diff options
-rw-r--r-- | iutil.py | 26 | ||||
-rw-r--r-- | packages.py | 9 | ||||
-rw-r--r-- | syslogd.py | 37 |
3 files changed, 39 insertions, 33 deletions
@@ -370,30 +370,4 @@ def swapAmount(): mem = int(long (fields[1]) / 1024) return mem - -class InstSyslog: - def __init__ (self, root, log): - self.pid = os.fork () - if not self.pid: - # look on PYTHONPATH first, so we use updated anaconda - path = None - if os.environ.has_key('PYTHONPATH'): - for f in string.split(os.environ['PYTHONPATH'], ":"): - if os.access (f+"/anaconda", os.X_OK): - path = f+"/anaconda" - break - - if not path: - if os.access ("./anaconda", os.X_OK): - path = "./anaconda" - elif os.access ("/usr/bin/anaconda.real", os.X_OK): - path = "/usr/bin/anaconda.real" - else: - path = "/usr/bin/anaconda" - - os.execv (path, ("syslogd", "--syslogd", root, log)) - - def __del__ (self): - os.kill (self.pid, 15) - os.wait (self.pid) diff --git a/packages.py b/packages.py index 4b4f5b340..457f2929f 100644 --- a/packages.py +++ b/packages.py @@ -26,6 +26,7 @@ from log import log from flags import flags from constants import * from translate import _ +from syslogd import syslog def queryUpgradeContinue(intf, dir): if dir == DISPATCH_FORWARD: @@ -306,7 +307,6 @@ def turnOnFilesystems(dir, thefsset, diskset, upgrade, instPath): thefsset.mountFilesystems (instPath) def doInstall(method, id, intf, instPath): - id.fsset.verify() if flags.test: return @@ -434,7 +434,7 @@ def doInstall(method, id, intf, instPath): pass instLog = open(instLogName, "w+") - syslog = iutil.InstSyslog (instPath, instPath + logname) + syslog.start (instPath, instPath + logname) ts.scriptFd = instLog.fileno () # the transaction set dup()s the file descriptor and will close the @@ -524,7 +524,7 @@ def doInstall(method, id, intf, instPath): del ts del db instLog.close() - del syslog + syslog.stop() method.systemUnmounted () @@ -681,14 +681,11 @@ def doInstall(method, id, intf, instPath): w.set(8) - del syslog - finally: pass w.pop () - id.fsset.verify() sys.stdout.flush() def migrateXinetd(instPath, instLog): diff --git a/syslogd.py b/syslogd.py index afe31eefd..5a0ce788f 100644 --- a/syslogd.py +++ b/syslogd.py @@ -1,5 +1,5 @@ # -# syslogd.py - a simple syslogd implementation +# syslogd.py - a simple syslogd implementation and wrapper for launching it # # Erik Troan <ewt@redhat.com> # @@ -14,6 +14,7 @@ # import sys, os +import string from socket import * from select import select @@ -52,3 +53,37 @@ class Syslogd: output = output filename = root + socket; self.goSyslog(output, filename) + +class InstSyslog: + def __init__ (self): + self.pid = -1; + + def start (self, root, log): + self.pid = os.fork () + if not self.pid: + # look on PYTHONPATH first, so we use updated anaconda + path = None + if os.environ.has_key('PYTHONPATH'): + for f in string.split(os.environ['PYTHONPATH'], ":"): + if os.access (f+"/anaconda", os.X_OK): + path = f+"/anaconda" + break + + if not path: + if os.access ("./anaconda", os.X_OK): + path = "./anaconda" + elif os.access ("/usr/bin/anaconda.real", os.X_OK): + path = "/usr/bin/anaconda.real" + else: + path = "/usr/bin/anaconda" + + os.execv (path, ("syslogd", "--syslogd", root, log)) + + def stop(self): + if self.pid == -1: + raise RuntimeError, "syslogd not running" + os.kill (self.pid, 15) + os.wait (self.pid) + self.pid = -1 + +syslog = InstSyslog() |