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

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

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


Revision 1.10.2.4 - (hide annotations) (download) (as text)
Sat Mar 15 18:11:42 2008 UTC (16 years, 7 months ago) by slords
Branch: SME8
Changes since 1.10.2.3: +1 -1 lines
Content type: text/x-python
Fix mkdir

1 slords 1.10.2.1 from installclass import getBaseInstallClass
2 slords 1.1 from rhpl.translate import N_, _
3 slords 1.2 from constants import *
4 slords 1.1 import os
5 slords 1.8 import iutil
6 slords 1.10.2.1 import rhpl
7    
8     baseclass = getBaseInstallClass()
9    
10 slords 1.10.2.3 import logging
11     log = logging.getLogger("anaconda")
12    
13     import string
14 slords 1.2
15     class Script:
16     def __repr__(self):
17     str = ("(s: '%s' i: %s c: %d)") % \
18     (self.script, self.interp, self.inChroot)
19     return string.replace(str, "\n", "|")
20    
21     def __init__(self, script, interp, inChroot, logfile = None):
22     self.script = script
23     self.interp = interp
24     self.inChroot = inChroot
25     self.logfile = logfile
26    
27     def run(self, chroot, serial):
28 slords 1.10.2.3 import tempfile
29     import os.path
30    
31     if self.inChroot:
32     scriptRoot = chroot
33     else:
34     scriptRoot = "/"
35    
36     (fd, path) = tempfile.mkstemp("", "sme-script-", scriptRoot + "/tmp")
37    
38     os.write(fd, self.script)
39     os.close(fd)
40     os.chmod(path, 0700)
41 slords 1.2
42     if self.logfile is not None:
43     messages = self.logfile
44 slords 1.10.2.3 elif serial:
45     messages = "%s.log" % path
46     else:
47     messages = "/dev/tty3"
48    
49     rc = iutil.execWithRedirect(self.interp, ["/tmp/%s" % os.path.basename(path)],
50     stdin = messages, stdout = messages, stderr = messages,
51     root = scriptRoot)
52 slords 1.2
53     if rc != 0:
54 slords 1.10.2.3 log.error("WARNING - Error code %s encountered running a sme script", rc)
55 slords 1.2
56     os.unlink(path)
57 slords 1.10.2.3 if serial or self.logfile is not None:
58     os.chmod("%s" % messages, 0600)
59 slords 1.1
60 slords 1.10.2.1 class InstallClass(baseclass):
61 slords 1.1 name = N_("Upgrade Existing System")
62     pixmap = "upgrade.png"
63     sortPriority = 999999
64    
65     parentClass = ( _("Upgrade"), "upgrade.png" )
66    
67     def requiredDisplayMode(self):
68     return 't'
69    
70     def setSteps(self, dispatch):
71     dispatch.setStepList(
72     "language",
73     "keyboard",
74     "findrootparts",
75 slords 1.2 "findinstall",
76     "installtype",
77 slords 1.1 "partitionobjinit",
78     "upgrademount",
79     "upgrademigfind",
80     "upgrademigratefs",
81     "upgradecontinue",
82 slords 1.10.2.1 "reposetup",
83     "upgbootloader",
84 slords 1.1 "checkdeps",
85     "dependencies",
86 slords 1.10.2.1 "postselection",
87 slords 1.1 "install",
88     "migratefilesystems",
89     "preinstallconfig",
90     "installpackages",
91     "postinstallconfig",
92     "instbootloader",
93     "dopostaction",
94     "methodcomplete",
95     "copylogs",
96     "complete"
97     )
98    
99 slords 1.8 if iutil.getPPCMachine() == "iSeries":
100     dispatch.skipStep("bootloadersetup", skip = 0)
101    
102 slords 1.10.2.1 if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
103 slords 1.8 dispatch.skipStep("bootloader")
104     dispatch.skipStep("bootloaderadvanced")
105    
106 slords 1.10.2.1 if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
107 slords 1.8 dispatch.skipStep("upgbootloader")
108    
109 slords 1.10.2.1 def postAction(self, anaconda, serial):
110     win = anaconda.intf.waitWindow(_("Post Upgrade Script"),
111 gordonr 1.7 _("The post upgrade script is running..."))
112    
113 slords 1.10.2.4 script = ( "#!/bin/sh\nmkdir -p /var/lib/dhcp; /sbin/syslogd ; sleep 2; /sbin/e-smith/signal-event post-upgrade\n" )
114 slords 1.2 s = Script(script, interp="/bin/sh", inChroot=1)
115 slords 1.10.2.1 log.info("%s", s)
116     s.run(anaconda.rootPath, serial)
117 gordonr 1.7 win.pop()
118 slords 1.1
119 slords 1.10.2.1 def setInstallData(self, anaconda):
120     baseclass.setInstallData(self, anaconda)
121     anaconda.id.setUpgrade(True)
122 slords 1.1
123     def __init__(self, expert):
124 slords 1.10.2.1 baseclass.__init__(self, expert)

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