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

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

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


Revision 1.10.2.8 - (show annotations) (download) (as text)
Wed Oct 8 17:37:05 2008 UTC (16 years, 1 month ago) by slords
Branch: SME8
Changes since 1.10.2.7: +1 -1 lines
Content type: text/x-python
Add format warning

1 from installclass import getBaseInstallClass
2 from rhpl.translate import N_, _
3 from constants import *
4 import os
5 import iutil
6 import rhpl
7
8 baseclass = getBaseInstallClass()
9
10 import logging
11 log = logging.getLogger("anaconda")
12
13 import string
14
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 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
42 if self.logfile is not None:
43 messages = self.logfile
44 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
53 if rc != 0:
54 log.error("WARNING - Error code %s encountered running a sme script", rc)
55
56 os.unlink(path)
57 if serial or self.logfile is not None:
58 os.chmod("%s" % messages, 0600)
59
60 class InstallClass(baseclass):
61 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 "installtype",
75 "findrootparts",
76 "findinstall",
77 "partitionobjinit",
78 "upgrademount",
79 "upgrademigfind",
80 "upgrademigratefs",
81 "upgradecontinue",
82 "reposetup",
83 "upgbootloader",
84 "checkdeps",
85 "dependencies",
86 "postselection",
87 "confirmupgrade",
88 "install",
89 "migratefilesystems",
90 "preinstallconfig",
91 "installpackages",
92 "postinstallconfig",
93 "instbootloader",
94 "dopostaction",
95 "methodcomplete",
96 "copylogs",
97 "complete"
98 )
99
100 if iutil.getPPCMachine() == "iSeries":
101 dispatch.skipStep("bootloadersetup", skip = 0)
102
103 if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
104 dispatch.skipStep("bootloader")
105 dispatch.skipStep("bootloaderadvanced")
106
107 if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
108 dispatch.skipStep("upgbootloader")
109
110 def postAction(self, anaconda, serial):
111 win = anaconda.intf.waitWindow(_("Post Upgrade Script"),
112 _("The post upgrade script is running..."))
113
114 script = ( "#!/bin/sh\nmkdir -p /var/lib/dhcp; /sbin/syslogd ; sleep 2; /sbin/e-smith/signal-event post-upgrade\n" )
115 s = Script(script, interp="/bin/sh", inChroot=1)
116 log.info("%s", s)
117 s.run(anaconda.rootPath, serial)
118 win.pop()
119
120 def setInstallData(self, anaconda):
121 baseclass.setInstallData(self, anaconda)
122 anaconda.id.setUpgrade(True)
123
124 def __init__(self, expert):
125 baseclass.__init__(self, expert)

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