/[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.1 - (hide annotations) (download) (as text)
Fri Mar 14 19:29:10 2008 UTC (16 years, 7 months ago) by slords
Branch: SME8
Changes since 1.10: +24 -18 lines
Content type: text/x-python
Updates for SME8

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