1 |
from installclass import BaseInstallClass |
2 |
from rhpl.translate import N_, _ |
3 |
from rhpl.log import log |
4 |
|
5 |
import os |
6 |
import iutil |
7 |
|
8 |
class InstallClass(BaseInstallClass): |
9 |
name = N_("Upgrade Existing System") |
10 |
pixmap = "upgrade.png" |
11 |
sortPriority = 999999 |
12 |
|
13 |
parentClass = ( _("Upgrade"), "upgrade.png" ) |
14 |
|
15 |
def requiredDisplayMode(self): |
16 |
return 't' |
17 |
|
18 |
def setSteps(self, dispatch): |
19 |
dispatch.setStepList( |
20 |
"language", |
21 |
"keyboard", |
22 |
"findrootparts", |
23 |
"partitionobjinit", |
24 |
"upgrademount", |
25 |
"upgrademigfind", |
26 |
"upgrademigratefs", |
27 |
"upgradecontinue", |
28 |
"readcomps", |
29 |
"findpackages", |
30 |
"checkdeps", |
31 |
"dependencies", |
32 |
"install", |
33 |
"migratefilesystems", |
34 |
"preinstallconfig", |
35 |
"installpackages", |
36 |
"postinstallconfig", |
37 |
"instbootloader", |
38 |
"dopostaction", |
39 |
"methodcomplete", |
40 |
"copylogs", |
41 |
"complete" |
42 |
) |
43 |
|
44 |
def postAction(self, rootPath, serial): |
45 |
if serial: |
46 |
messages = "/tmp/postupgrade.log" |
47 |
else: |
48 |
messages = "/dev/tty3" |
49 |
args = [ "/usr/sbin/lokkit", "--quiet", "--nostart", "--selinux=disabled"] |
50 |
|
51 |
try: |
52 |
iutil.execWithRedirect(args[0], args, root=rootPath, |
53 |
stdout=messages, stderr=messages) |
54 |
except RuntimeError, msg: |
55 |
log ("lokkit run failed: %s", msg) |
56 |
except OSError, (errno, msg): |
57 |
log ("lokkit run failed: %s", msg) |
58 |
|
59 |
path = rootPath + "/tmp/postupgrade.sh" |
60 |
cmds = ["/sbin/syslogd &", "sleep 2", "/sbin/e-smith/signal-event post-upgrade"] |
61 |
|
62 |
f = open(path, "w") |
63 |
f.writelines(cmds) |
64 |
f.close |
65 |
os.chmod(path, 0700) |
66 |
|
67 |
rc = iutil.execWithRedirect("/bin/sh", ["/bin/sh", "/tmp/postupgrade.sh"], |
68 |
stdout=messages, stderr=messages, root=rootPath) |
69 |
if rc != 0: |
70 |
log("WARNING - Error code %s encountered running postupgrade script", rc) |
71 |
os.unlink(path) |
72 |
|
73 |
def setInstallData(self, id): |
74 |
BaseInstallClass.setInstallData(self, id) |
75 |
id.upgrade.set(1) |
76 |
|
77 |
def __init__(self, expert): |
78 |
BaseInstallClass.__init__(self, expert) |