/[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.11 - (hide annotations) (download) (as text)
Mon Mar 17 17:28:05 2008 UTC (16 years, 7 months ago) by slords
Branch: MAIN
Changes since 1.10: +1 -0 lines
Content type: text/x-python
Updates

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

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