/[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.8 - (hide annotations) (download) (as text)
Wed Oct 8 17:37:05 2008 UTC (15 years, 8 months ago) by slords
Branch: SME8
Changes since 1.10.2.7: +1 -1 lines
Content type: text/x-python
Add format warning

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 slords 1.10.2.7 dispatch.setStepList(
72     "language",
73     "keyboard",
74     "installtype",
75 slords 1.1 "findrootparts",
76 slords 1.10.2.7 "findinstall",
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 slords 1.10.2.7 "dependencies",
86 slords 1.10.2.1 "postselection",
87 slords 1.10.2.8 "confirmupgrade",
88 slords 1.10.2.7 "install",
89 slords 1.1 "migratefilesystems",
90     "preinstallconfig",
91     "installpackages",
92     "postinstallconfig",
93     "instbootloader",
94     "dopostaction",
95     "methodcomplete",
96     "copylogs",
97 slords 1.10.2.7 "complete"
98     )
99 slords 1.1
100 slords 1.8 if iutil.getPPCMachine() == "iSeries":
101     dispatch.skipStep("bootloadersetup", skip = 0)
102    
103 slords 1.10.2.1 if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
104 slords 1.8 dispatch.skipStep("bootloader")
105     dispatch.skipStep("bootloaderadvanced")
106    
107 slords 1.10.2.1 if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
108 slords 1.8 dispatch.skipStep("upgbootloader")
109    
110 slords 1.10.2.1 def postAction(self, anaconda, serial):
111     win = anaconda.intf.waitWindow(_("Post Upgrade Script"),
112 gordonr 1.7 _("The post upgrade script is running..."))
113    
114 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" )
115 slords 1.2 s = Script(script, interp="/bin/sh", inChroot=1)
116 slords 1.10.2.1 log.info("%s", s)
117     s.run(anaconda.rootPath, serial)
118 gordonr 1.7 win.pop()
119 slords 1.1
120 slords 1.10.2.1 def setInstallData(self, anaconda):
121     baseclass.setInstallData(self, anaconda)
122     anaconda.id.setUpgrade(True)
123 slords 1.1
124     def __init__(self, expert):
125 slords 1.10.2.1 baseclass.__init__(self, expert)

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