/[smeserver]/cdrom.image/updates/smeupgradeclass.py
ViewVC logotype

Diff of /cdrom.image/updates/smeupgradeclass.py

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.10.2.1 by slords, Fri Mar 14 19:29:10 2008 UTC Revision 1.10.2.5 by slords, Mon Mar 17 17:28:11 2008 UTC
# Line 1  Line 1 
1  from installclass import getBaseInstallClass  from installclass import getBaseInstallClass
2  from rhpl.translate import N_, _  from rhpl.translate import N_, _
   
 import logging  
 log = logging.getLogger("anaconda")  
   
3  from constants import *  from constants import *
   
4  import os  import os
5  import iutil  import iutil
 import string  
6  import rhpl  import rhpl
7    
8  baseclass = getBaseInstallClass()  baseclass = getBaseInstallClass()
9    
10    import logging
11    log = logging.getLogger("anaconda")
12    
13    import string
14    
15  class Script:  class Script:
16      def __repr__(self):      def __repr__(self):
# Line 27  class Script: Line 25  class Script:
25          self.logfile = logfile          self.logfile = logfile
26    
27      def run(self, chroot, serial):      def run(self, chroot, serial):
28          scriptRoot = "/"          import tempfile
29          if self.inChroot:          import os.path
30              scriptRoot = chroot  
31            if self.inChroot:
32          path = scriptRoot + "/tmp/sme-script"              scriptRoot = chroot
33            else:
34          f = open(path, "w")              scriptRoot = "/"
35          f.write(self.script)  
36          f.close()          (fd, path) = tempfile.mkstemp("", "sme-script-", scriptRoot + "/tmp")
37          os.chmod(path, 0700)  
38            os.write(fd, self.script)
39            os.close(fd)
40            os.chmod(path, 0700)
41    
42          if self.logfile is not None:          if self.logfile is not None:
43              messages = self.logfile              messages = self.logfile
44          elif serial:          elif serial:
45              messages = "/tmp/sme-script.log"              messages = "%s.log" % path
46          else:          else:
47              messages = "/dev/tty3"              messages = "/dev/tty3"
48    
49          rc = iutil.execWithRedirect(self.interp,          rc = iutil.execWithRedirect(self.interp, ["/tmp/%s" % os.path.basename(path)],
50                                      [self.interp,"/tmp/sme-script"],                                      stdin = messages, stdout = messages, stderr = messages,
51                                      stdout = messages, stderr = messages,                                      root = scriptRoot)
                                     root = scriptRoot)  
52    
53          if rc != 0:          if rc != 0:
54              log.info("WARNING - Error code %s encountered running a sme script", rc)              log.error("WARNING - Error code %s encountered running a sme script", rc)
55    
56          os.unlink(path)          os.unlink(path)
57            if serial or self.logfile is not None:
58                os.chmod("%s" % messages, 0600)
59    
60  class InstallClass(baseclass):  class InstallClass(baseclass):
61      name = N_("Upgrade Existing System")      name = N_("Upgrade Existing System")
# Line 67  class InstallClass(baseclass): Line 69  class InstallClass(baseclass):
69    
70      def setSteps(self, dispatch):      def setSteps(self, dispatch):
71          dispatch.setStepList(          dispatch.setStepList(
72                        "betanag",
73                      "language",                      "language",
74                      "keyboard",                      "keyboard",
75                      "findrootparts",                      "findrootparts",
# Line 108  class InstallClass(baseclass): Line 111  class InstallClass(baseclass):
111          win = anaconda.intf.waitWindow(_("Post Upgrade Script"),          win = anaconda.intf.waitWindow(_("Post Upgrade Script"),
112             _("The post upgrade script is running..."))             _("The post upgrade script is running..."))
113    
114          script = ( "/sbin/syslogd &\n"          script = ( "#!/bin/sh\nmkdir -p /var/lib/dhcp; /sbin/syslogd ; sleep 2; /sbin/e-smith/signal-event post-upgrade\n" )
                    "sleep 2\n"  
                    "/sbin/e-smith/signal-event post-upgrade\n" )  
115          s = Script(script, interp="/bin/sh", inChroot=1)          s = Script(script, interp="/bin/sh", inChroot=1)
116          log.info("%s", s)          log.info("%s", s)
117          s.run(anaconda.rootPath, serial)          s.run(anaconda.rootPath, serial)


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed