1 |
charlieb |
1.1 |
#!/usr/bin/python |
2 |
|
|
# |
3 |
|
|
# anaconda: The Red Hat Linux Installation program |
4 |
|
|
# |
5 |
|
|
# (in alphabetical order...) |
6 |
|
|
# |
7 |
|
|
# Brent Fox <bfox@redhat.com> |
8 |
|
|
# Mike Fulbright <msf@redhat.com> |
9 |
|
|
# Jakub Jelinek <jakub@redhat.com> |
10 |
|
|
# Jeremy Katz <katzj@redhat.com> |
11 |
|
|
# Erik Troan <ewt@redhat.com> |
12 |
|
|
# Matt Wilson <msw@specifixinc.com> |
13 |
|
|
# |
14 |
|
|
# ... And many others |
15 |
|
|
# |
16 |
|
|
# Copyright 1999-2004 Red Hat, Inc. |
17 |
|
|
# |
18 |
|
|
# This software may be freely redistributed under the terms of the GNU |
19 |
|
|
# library public license. |
20 |
|
|
# |
21 |
|
|
# You should have received a copy of the GNU Library Public License |
22 |
|
|
# along with this program; if not, write to the Free Software |
23 |
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
24 |
|
|
# |
25 |
|
|
|
26 |
|
|
# This toplevel file is a little messy at the moment... |
27 |
|
|
|
28 |
|
|
import sys, os |
29 |
|
|
|
30 |
|
|
# keep up with process ID of miniwm if we start it |
31 |
|
|
|
32 |
|
|
miniwm_pid = None |
33 |
|
|
# helper function to duplicate diagnostic output |
34 |
|
|
def dup_log(format, *args): |
35 |
|
|
if args: |
36 |
|
|
sys.stdout.write ("%s\n" % (format % args)) |
37 |
|
|
else: |
38 |
|
|
sys.stdout.write ("%s\n" % format) |
39 |
|
|
apply(log, (format,) + args) |
40 |
|
|
|
41 |
|
|
# start miniWM |
42 |
|
|
def startMiniWM(root='/'): |
43 |
|
|
(rd, wr) = os.pipe() |
44 |
|
|
childpid = os.fork() |
45 |
|
|
if not childpid: |
46 |
|
|
if os.access("./mini-wm", os.X_OK): |
47 |
|
|
cmd = "./mini-wm" |
48 |
|
|
elif os.access(root + "/usr/bin/mini-wm", os.X_OK): |
49 |
|
|
cmd = root + "/usr/bin/mini-wm" |
50 |
|
|
else: |
51 |
|
|
return None |
52 |
|
|
|
53 |
|
|
os.dup2(wr, 1) |
54 |
|
|
os.close(wr) |
55 |
|
|
args = [cmd, '--display', ':1'] |
56 |
|
|
os.execv(args[0], args) |
57 |
|
|
sys.exit (1) |
58 |
|
|
else: |
59 |
|
|
# We need to make sure that mini-wm is the first client to |
60 |
|
|
# connect to the X server (see bug #108777). Wait for mini-wm |
61 |
|
|
# to write back an acknowledge token. |
62 |
|
|
os.read(rd, 1) |
63 |
|
|
|
64 |
|
|
return childpid |
65 |
|
|
|
66 |
|
|
# startup vnc X server |
67 |
|
|
def startVNCServer(vncpassword=None, root='/', vncconnecthost=None, |
68 |
|
|
vncconnectport=None): |
69 |
|
|
|
70 |
|
|
def set_vnc_password(root, passwd, passwd_file): |
71 |
|
|
(pid, fd) = os.forkpty() |
72 |
|
|
|
73 |
|
|
if not pid: |
74 |
|
|
os.execv(root + "/usr/bin/vncpasswd", [root + "/usr/bin/vncpasswd", passwd_file]) |
75 |
|
|
sys.exit(1) |
76 |
|
|
|
77 |
|
|
# read password prompt |
78 |
|
|
os.read(fd, 1000) |
79 |
|
|
|
80 |
|
|
# write password |
81 |
|
|
os.write(fd, passwd + "\n") |
82 |
|
|
|
83 |
|
|
# read challenge again, and newline |
84 |
|
|
os.read(fd, 1000) |
85 |
|
|
os.read(fd, 1000) |
86 |
|
|
|
87 |
|
|
# write password again |
88 |
|
|
os.write(fd, passwd + "\n") |
89 |
|
|
|
90 |
|
|
# read remaining output |
91 |
|
|
os.read(fd, 1000) |
92 |
|
|
|
93 |
|
|
# wait for status |
94 |
|
|
try: |
95 |
|
|
(pid, status) = os.waitpid(pid, 0) |
96 |
|
|
except OSError, (errno, msg): |
97 |
|
|
print __name__, "waitpid:", msg |
98 |
|
|
|
99 |
|
|
return status |
100 |
|
|
|
101 |
|
|
|
102 |
|
|
dup_log(_("Starting VNC...")) |
103 |
|
|
|
104 |
|
|
# figure out host info |
105 |
|
|
connxinfo = None |
106 |
|
|
srvname = None |
107 |
|
|
try: |
108 |
|
|
import network |
109 |
|
|
|
110 |
|
|
# try to load /tmp/netinfo and see if we can sniff out network info |
111 |
|
|
netinfo = network.Network() |
112 |
|
|
srvname = None |
113 |
|
|
if netinfo.hostname != "localhost.localdomain": |
114 |
|
|
srvname = "%s" % (netinfo.hostname,) |
115 |
|
|
else: |
116 |
|
|
for dev in netinfo.netdevices.keys(): |
117 |
|
|
try: |
118 |
|
|
ip = isys.getIPAddress(dev) |
119 |
|
|
log("ip of %s is %s" %(dev, ip)) |
120 |
|
|
except Exception, e: |
121 |
|
|
log("Got an exception trying to get the ip addr of %s: " |
122 |
|
|
"%s" %(dev, e)) |
123 |
|
|
continue |
124 |
|
|
if ip == '127.0.0.1' or ip is None: |
125 |
|
|
continue |
126 |
|
|
srvname = ip |
127 |
|
|
break |
128 |
|
|
|
129 |
|
|
if srvname is not None: |
130 |
|
|
connxinfo = "%s:1" % (srvname,) |
131 |
|
|
|
132 |
|
|
except: |
133 |
|
|
log("Unable to determine VNC server network info") |
134 |
|
|
|
135 |
|
|
# figure out product info |
136 |
|
|
if srvname is not None: |
137 |
|
|
desktopname = _("%s %s installation on host %s") % (product.productName, product.productVersion, srvname) |
138 |
|
|
else: |
139 |
|
|
desktopname = _("%s %s installation") % (product.productName, product.productVersion) |
140 |
|
|
|
141 |
|
|
vncpid = os.fork() |
142 |
|
|
|
143 |
|
|
if not vncpid: |
144 |
|
|
args = [ root + "/usr/bin/Xvnc", ":1", "-nevershared", |
145 |
|
|
"-depth", "16", "-geometry", "800x600", |
146 |
|
|
"IdleTimeout=0", "-auth", "/dev/null", "-once", |
147 |
|
|
"DisconnectClients=false", "desktop=%s" % (desktopname,)] |
148 |
|
|
|
149 |
|
|
# set passwd if necessary |
150 |
|
|
if vncpassword is not None: |
151 |
|
|
try: |
152 |
|
|
rc = set_vnc_password(root, vncpassword, "/tmp/vncpasswd_file") |
153 |
|
|
except Exception, e: |
154 |
|
|
dup_log("Unknown exception setting vnc password.") |
155 |
|
|
log("Exception was: %s" %(e,)) |
156 |
|
|
rc = 1 |
157 |
|
|
|
158 |
|
|
if rc: |
159 |
|
|
dup_log(_("Unable to set vnc password - using no password!")) |
160 |
|
|
dup_log(_("Make sure your password is at least 6 characters in length.")) |
161 |
|
|
else: |
162 |
|
|
args = args + ["-rfbauth", "/tmp/vncpasswd_file"] |
163 |
|
|
else: |
164 |
|
|
# needed if no password specified |
165 |
|
|
args = args + ["SecurityTypes=None",] |
166 |
|
|
|
167 |
|
|
tmplogFile = "/tmp/vncserver.log" |
168 |
|
|
try: |
169 |
|
|
err = os.open(tmplogFile, os.O_RDWR | os.O_CREAT) |
170 |
|
|
if err < 0: |
171 |
|
|
sys.stderr.write("error opening %s\n", tmplogFile) |
172 |
|
|
else: |
173 |
|
|
os.dup2(err, 2) |
174 |
|
|
os.close(err) |
175 |
|
|
except: |
176 |
|
|
# oh well |
177 |
|
|
pass |
178 |
|
|
|
179 |
|
|
os.execv(args[0], args) |
180 |
|
|
sys.exit (1) |
181 |
|
|
|
182 |
|
|
if vncpassword is None: |
183 |
|
|
dup_log(_("\n\nWARNING!!! VNC server running with NO PASSWORD!\n" |
184 |
|
|
"You can use the vncpassword=<password> boot option\n" |
185 |
|
|
"if you would like to secure the server.\n\n")) |
186 |
|
|
|
187 |
|
|
dup_log(_("The VNC server is now running.")) |
188 |
|
|
|
189 |
|
|
if vncconnecthost is not None: |
190 |
|
|
dup_log(_("Attempting to connect to vnc client on host %s...") % (vncconnecthost,)) |
191 |
|
|
|
192 |
|
|
hostarg = vncconnecthost |
193 |
|
|
if vncconnectport is not None: |
194 |
|
|
hostarg = hostarg + ":" + vncconnectport |
195 |
|
|
|
196 |
|
|
argv = ["/usr/bin/vncconfig", "-display", ":1", "-connect", hostarg] |
197 |
|
|
ntries = 0 |
198 |
|
|
while 1: |
199 |
|
|
output=iutil.execWithCapture(argv[0], argv, catchfd=2) |
200 |
|
|
outfields = string.split(string.strip(output), ' ') |
201 |
|
|
if outfields[0] == "connecting" and outfields[-1] == "failed": |
202 |
|
|
ntries += 1 |
203 |
|
|
if ntries > 50: |
204 |
|
|
dup_log(_("Giving up attempting to connect after 50 tries!\n")) |
205 |
|
|
if connxinfo is not None: |
206 |
|
|
dup_log(_("Please manually connect your vnc client to %s to begin the install.") % (connxinfo,)) |
207 |
|
|
else: |
208 |
|
|
dup_log(_("Please manually connect your vnc client to begin the install.")) |
209 |
|
|
break |
210 |
|
|
|
211 |
|
|
dup_log(output) |
212 |
|
|
dup_log(_("Will try to connect again in 15 seconds...")) |
213 |
|
|
time.sleep(15) |
214 |
|
|
continue |
215 |
|
|
else: |
216 |
|
|
dup_log(_("Connected!")) |
217 |
|
|
break |
218 |
|
|
else: |
219 |
|
|
if connxinfo is not None: |
220 |
|
|
dup_log(_("Please connect to %s to begin the install...") % (connxinfo,)) |
221 |
|
|
else: |
222 |
|
|
dup_log(_("Please connect to begin the install...")) |
223 |
|
|
|
224 |
|
|
os.environ["DISPLAY"]=":1" |
225 |
|
|
doStartupX11Actions() |
226 |
|
|
|
227 |
|
|
# function to handle X startup special issues for anaconda |
228 |
|
|
def doStartupX11Actions(): |
229 |
|
|
global miniwm_pid |
230 |
|
|
|
231 |
|
|
# now start up mini-wm |
232 |
|
|
try: |
233 |
|
|
miniwm_pid = startMiniWM() |
234 |
|
|
log("Started mini-wm") |
235 |
|
|
except: |
236 |
|
|
miniwm_pid = None |
237 |
|
|
log("Unable to start mini-wm") |
238 |
|
|
|
239 |
|
|
# test to setup dpi |
240 |
|
|
# cant do this if miniwm didnt run because otherwise when |
241 |
|
|
# we open and close an X connection in the xutils calls |
242 |
|
|
# the X server will exit since this is the first X |
243 |
|
|
# connection (if miniwm isnt running) |
244 |
|
|
if miniwm_pid is not None: |
245 |
|
|
import xutils |
246 |
|
|
|
247 |
|
|
try: |
248 |
|
|
if xutils.screenWidth() > 640: |
249 |
|
|
dpi = "96" |
250 |
|
|
else: |
251 |
|
|
dpi = "75" |
252 |
|
|
|
253 |
|
|
|
254 |
|
|
xutils.setRootResource('Xcursor.size', '24') |
255 |
|
|
xutils.setRootResource('Xcursor.theme', 'Bluecurve') |
256 |
|
|
xutils.setRootResource('Xcursor.theme_core', 'true') |
257 |
|
|
|
258 |
|
|
xutils.setRootResource('Xft.antialias', '1') |
259 |
|
|
xutils.setRootResource('Xft.dpi', dpi) |
260 |
|
|
xutils.setRootResource('Xft.hinting', '1') |
261 |
|
|
xutils.setRootResource('Xft.hintstyle', 'hintslight') |
262 |
|
|
xutils.setRootResource('Xft.rgba', 'none') |
263 |
|
|
except: |
264 |
|
|
sys.stderr.write("X SERVER STARTED, THEN FAILED"); |
265 |
|
|
raise RuntimeError, "X server failed to start" |
266 |
|
|
|
267 |
|
|
def doShutdownX11Actions(): |
268 |
|
|
global miniwm_pid |
269 |
|
|
|
270 |
|
|
if miniwm_pid is not None: |
271 |
|
|
try: |
272 |
|
|
os.kill(miniwm_pid, 15) |
273 |
|
|
os.waitpid(miniwm_pid, 0) |
274 |
|
|
except: |
275 |
|
|
pass |
276 |
|
|
|
277 |
|
|
|
278 |
|
|
def setupRhplUpdates(): |
279 |
|
|
import glob |
280 |
|
|
|
281 |
|
|
# get the python version. first of /usr/lib/python*, strip off the |
282 |
|
|
# first 15 chars |
283 |
|
|
pyvers = glob.glob("/usr/lib/python*") |
284 |
|
|
pyver = pyvers[0][15:] |
285 |
|
|
|
286 |
|
|
try: |
287 |
|
|
os.mkdir("/tmp/updates") |
288 |
|
|
except: |
289 |
|
|
pass |
290 |
|
|
try: |
291 |
|
|
os.mkdir("/tmp/updates/rhpl") |
292 |
|
|
except: |
293 |
|
|
pass |
294 |
|
|
if os.access("/mnt/source/RHupdates/rhpl", os.X_OK): |
295 |
|
|
for f in os.listdir("/mnt/source/RHupdates/rhpl"): |
296 |
|
|
os.symlink("/mnt/source/RHupdates/rhpl/%s" %(f,), |
297 |
|
|
"/tmp/updates/rhpl/%s" %(f,)) |
298 |
|
|
|
299 |
|
|
if os.access("/usr/lib64/python%s/site-packages/rhpl" %(pyver,), os.X_OK): |
300 |
|
|
libdir = "lib64" |
301 |
|
|
else: |
302 |
|
|
libdir = "lib" |
303 |
|
|
|
304 |
|
|
for f in os.listdir("/usr/%s/python%s/site-packages/rhpl" %(libdir,pyver)): |
305 |
|
|
if os.access("/tmp/updates/rhpl/%s" %(f,), os.R_OK): |
306 |
|
|
continue |
307 |
|
|
elif f.endswith(".pyc") and os.access("/tmp/updates/rhpl/%s" %(f[:-1],), os.R_OK): |
308 |
|
|
# dont copy .pyc files we are replacing with updates |
309 |
|
|
continue |
310 |
|
|
|
311 |
|
|
os.symlink("/usr/%s/python%s/site-packages/rhpl/%s" %(libdir, pyver,f), |
312 |
|
|
"/tmp/updates/rhpl/%s" %(f,)) |
313 |
|
|
|
314 |
|
|
# For anaconda in test mode |
315 |
|
|
if (os.path.exists('isys')): |
316 |
|
|
sys.path.append('isys') |
317 |
|
|
sys.path.append('textw') |
318 |
|
|
sys.path.append('iw') |
319 |
|
|
else: |
320 |
|
|
sys.path.append('/usr/lib/anaconda') |
321 |
|
|
sys.path.append('/usr/lib/anaconda/textw') |
322 |
|
|
sys.path.append('/usr/lib/anaconda/iw') |
323 |
|
|
|
324 |
|
|
if (os.path.exists('booty')): |
325 |
|
|
sys.path.append('booty') |
326 |
|
|
sys.path.append('booty/edd') |
327 |
|
|
else: |
328 |
|
|
sys.path.append('/usr/lib/booty') |
329 |
|
|
|
330 |
|
|
sys.path.append('/usr/share/system-config-keyboard') |
331 |
|
|
|
332 |
|
|
try: |
333 |
|
|
import updates_disk_hook |
334 |
|
|
except ImportError: |
335 |
|
|
pass |
336 |
|
|
|
337 |
|
|
# pull this in to get product name and versioning |
338 |
|
|
import product |
339 |
|
|
|
340 |
|
|
# do this early to keep our import footprint as small as possible |
341 |
|
|
# Python passed my path as argv[0]! |
342 |
|
|
# if sys.argv[0][-7:] == "syslogd": |
343 |
|
|
if len(sys.argv) > 1: |
344 |
|
|
if sys.argv[1] == "--syslogd": |
345 |
|
|
from syslogd import Syslogd |
346 |
|
|
root = sys.argv[2] |
347 |
|
|
output = sys.argv[3] |
348 |
|
|
syslog = Syslogd (root, open (output, "a")) |
349 |
|
|
# this never returns |
350 |
|
|
|
351 |
|
|
# this handles setting up RHupdates for rhpl to minimize the set needed |
352 |
|
|
if (os.access("/mnt/source/RHupdates/rhpl", os.X_OK) or |
353 |
|
|
os.access("/tmp/updates/rhpl", os.X_OK)): |
354 |
|
|
setupRhplUpdates() |
355 |
|
|
|
356 |
|
|
import signal, traceback, string, isys, iutil, time |
357 |
|
|
|
358 |
|
|
from exception import handleException |
359 |
|
|
import dispatch |
360 |
|
|
from flags import flags |
361 |
|
|
from anaconda_log import anaconda_log |
362 |
|
|
|
363 |
|
|
from rhpl.log import log |
364 |
|
|
from rhpl.translate import _, textdomain, addPoPath |
365 |
|
|
|
366 |
|
|
if os.path.isdir("/mnt/source/RHupdates/po"): |
367 |
|
|
log("adding RHupdates/po") |
368 |
|
|
addPoPath("/mnt/source/RHupdates/po") |
369 |
|
|
if os.path.isdir("/tmp/updates/po"): |
370 |
|
|
log("adding /tmp/updates/po") |
371 |
|
|
addPoPath("/tmp/updates/po") |
372 |
|
|
textdomain("anaconda") |
373 |
|
|
|
374 |
|
|
# reset python's default SIGINT handler |
375 |
|
|
signal.signal(signal.SIGINT, signal.SIG_DFL) |
376 |
|
|
|
377 |
|
|
# Silly GNOME stuff |
378 |
|
|
if os.environ.has_key('HOME') and not os.environ.has_key("XAUTHORITY"): |
379 |
|
|
os.environ['XAUTHORITY'] = os.environ['HOME'] + '/.Xauthority' |
380 |
|
|
os.environ['HOME'] = '/tmp' |
381 |
|
|
os.environ['LC_NUMERIC'] = 'C' |
382 |
|
|
os.environ["GCONF_GLOBAL_LOCKS"] = "1" |
383 |
|
|
|
384 |
|
|
if os.environ.has_key ("ANACONDAARGS"): |
385 |
|
|
theargs = string.split (os.environ["ANACONDAARGS"]) |
386 |
|
|
else: |
387 |
|
|
theargs = sys.argv[1:] |
388 |
|
|
|
389 |
|
|
# we can't let the LD_PRELOAD hang around because it will leak into |
390 |
|
|
# rpm %post and the like. ick :/ |
391 |
|
|
if os.environ.has_key("LD_PRELOAD"): |
392 |
|
|
del os.environ["LD_PRELOAD"] |
393 |
|
|
|
394 |
|
|
# we need to do this really early so we make sure its done before rpm |
395 |
|
|
# is imported |
396 |
|
|
iutil.writeRpmPlatform() |
397 |
|
|
|
398 |
|
|
try: |
399 |
|
|
(args, extra) = isys.getopt(theargs, 'CGTRxtdr:fm:', |
400 |
|
|
[ 'graphical', 'text', 'test', 'debug', 'nofallback', |
401 |
|
|
'method=', 'rootpath=', 'pcic=', "overhead=", |
402 |
|
|
'testpath=', 'mountfs', 'traceonly', 'kickstart=', |
403 |
|
|
'lang=', 'keymap=', 'kbdtype=', 'module=', 'class=', |
404 |
|
|
'expert', 'serial', 'lowres', 'nofb', 'rescue', 'nomount', |
405 |
|
|
'autostep', 'resolution=', 'skipddc', 'noselinux', 'selinux', |
406 |
|
|
'vnc', 'vncconnect=', 'vnc=', 'cmdline', 'headless', |
407 |
|
|
'virtpconsole=']) |
408 |
|
|
except TypeError, msg: |
409 |
|
|
sys.stderr.write("Error %s\n:" % msg) |
410 |
|
|
sys.exit(-1) |
411 |
|
|
|
412 |
|
|
if extra: |
413 |
|
|
sys.stderr.write("Unexpected arguments: %s\n" % extra) |
414 |
|
|
sys.exit(-1) |
415 |
|
|
|
416 |
|
|
# Save the arguments in case we need to reexec anaconda for kon |
417 |
|
|
os.environ["ANACONDAARGS"] = string.join(sys.argv[1:]) |
418 |
|
|
|
419 |
|
|
# remove the arguments - gnome_init doesn't understand them |
420 |
|
|
savedargs = sys.argv[1:] |
421 |
|
|
sys.argv = sys.argv[:1] |
422 |
|
|
sys.argc = 1 |
423 |
|
|
|
424 |
|
|
# Parameters for the main anaconda routine |
425 |
|
|
# |
426 |
|
|
rootPath = '/mnt/sysimage' # where to instal packages |
427 |
|
|
extraModules = [] # kernel modules to use |
428 |
|
|
debug = 0 # start up pdb immediately |
429 |
|
|
traceOnly = 0 # don't run, just list modules we use |
430 |
|
|
nofallback = 0 # if GUI mode fails, exit |
431 |
|
|
rescue = 0 # run in rescue mode |
432 |
|
|
rescue_nomount = 0 # don't automatically mount device in rescue |
433 |
|
|
runres = '800x600' # resolution to run the GUI install in |
434 |
|
|
runres_override = 0 # was run resolution overridden by user? |
435 |
|
|
skipddc = 0 # if true skip ddcprobe (locks some machines) |
436 |
|
|
instClass = None # the install class to use |
437 |
|
|
progmode = 'install' # 'rescue', or 'install' |
438 |
|
|
method = None # URL representation of install method |
439 |
|
|
logFile = None # may be a file object or a file name |
440 |
|
|
display_mode = None |
441 |
|
|
graphical_failed = 0 |
442 |
|
|
|
443 |
|
|
|
444 |
|
|
# should we ever try to probe for X stuff? this will give us a convenient |
445 |
|
|
# out eventually to circumvent all probing and just fall back to text mode |
446 |
|
|
# on hardware where we break things if we probe |
447 |
charlieb |
1.3 |
isHeadless = 1 |
448 |
charlieb |
1.1 |
|
449 |
|
|
# probing for hardware on an s390 seems silly... |
450 |
|
|
if iutil.getArch() == "s390": |
451 |
|
|
isHeadless = 1 |
452 |
|
|
|
453 |
|
|
# |
454 |
|
|
# xcfg - xserver info (?) |
455 |
|
|
# mousehw - mouseinfo info |
456 |
|
|
# videohw - videocard info |
457 |
|
|
# monitorhw - monitor info |
458 |
|
|
# lang - language to use for install/machine default |
459 |
|
|
# keymap - kbd map |
460 |
|
|
# |
461 |
|
|
xcfg = None |
462 |
|
|
monitorhw = None |
463 |
|
|
videohw = None |
464 |
|
|
mousehw = None |
465 |
|
|
lang = None |
466 |
|
|
method = None |
467 |
|
|
keymap = None |
468 |
|
|
kbdtype = None |
469 |
|
|
progmode = None |
470 |
|
|
customClass = None |
471 |
|
|
kbd = None |
472 |
|
|
ksfile = None |
473 |
|
|
vncpassword = None |
474 |
|
|
vncconnecthost = None |
475 |
|
|
vncconnectport = None |
476 |
|
|
|
477 |
|
|
# |
478 |
|
|
# parse off command line arguments |
479 |
|
|
# |
480 |
|
|
for n in args: |
481 |
|
|
(str, arg) = n |
482 |
|
|
|
483 |
|
|
if (str == '--class'): |
484 |
|
|
customClass = arg |
485 |
|
|
elif (str == '-d' or str == '--debug'): |
486 |
|
|
debug = 1 |
487 |
|
|
elif (str == '--expert'): |
488 |
|
|
flags.expert = 1 |
489 |
|
|
elif (str == '--graphical'): |
490 |
|
|
display_mode = 'g' |
491 |
|
|
elif (str == '--keymap'): |
492 |
|
|
keymap = arg |
493 |
|
|
elif (str == '--kickstart'): |
494 |
|
|
from kickstart import Kickstart |
495 |
|
|
ksfile = arg |
496 |
|
|
instClass = Kickstart(ksfile, flags.serial) |
497 |
|
|
elif (str == '--lang'): |
498 |
|
|
lang = arg |
499 |
|
|
elif (str == '--lowres'): |
500 |
|
|
runres = '640x480' |
501 |
|
|
elif (str == '-m' or str == '--method'): |
502 |
|
|
method = arg |
503 |
|
|
if method[0] == '@': |
504 |
|
|
# ftp installs pass the password via a file in /tmp so |
505 |
|
|
# ps doesn't show it |
506 |
|
|
filename = method[1:] |
507 |
|
|
method = open(filename, "r").readline() |
508 |
|
|
method = method[:len(method) - 1] |
509 |
|
|
os.unlink(filename) |
510 |
|
|
elif (str == '--module'): |
511 |
|
|
(path, name) = string.split(arg, ":") |
512 |
|
|
extraModules.append((path, name)) |
513 |
|
|
elif (str == '--nofallback'): |
514 |
|
|
nofallback = 1 |
515 |
|
|
elif (str == "--nomount"): |
516 |
|
|
rescue_nomount = 1 |
517 |
|
|
elif (str == '--rescue'): |
518 |
|
|
progmode = 'rescue' |
519 |
|
|
elif (str == '--resolution'): |
520 |
|
|
# run native X server at specified resolution, ignore fb |
521 |
|
|
runres = arg |
522 |
|
|
runres_override = 1 |
523 |
|
|
elif (str == '--noselinux'): |
524 |
|
|
flags.selinux = 0 |
525 |
|
|
elif (str == '--selinux'): |
526 |
|
|
flags.selinux = 1 |
527 |
|
|
elif (str == "--skipddc"): |
528 |
|
|
skipddc = 1 |
529 |
|
|
elif (str == "--autostep"): |
530 |
|
|
flags.autostep = 1 |
531 |
|
|
elif (str == '-r' or str == '--rootpath'): |
532 |
|
|
rootPath = arg |
533 |
|
|
flags.setupFilesystems = 0 |
534 |
|
|
flags.rootpath = 1 |
535 |
|
|
logFile = sys.stderr |
536 |
|
|
elif (str == '--traceonly'): |
537 |
|
|
traceOnly = 1 |
538 |
|
|
elif (str == '--serial'): |
539 |
|
|
flags.serial = 1 |
540 |
|
|
elif (str == '-t' or str == '--test'): |
541 |
|
|
flags.test = 1 |
542 |
|
|
flags.setupFilesystems = 0 |
543 |
|
|
logFile = "/tmp/anaconda-debug.log" |
544 |
|
|
elif (str == '-T' or str == '--text'): |
545 |
|
|
display_mode = 't' |
546 |
|
|
elif (str == "-C" or str == "--cmdline"): |
547 |
|
|
display_mode = 'c' |
548 |
|
|
elif (str == '--kbdtype'): |
549 |
|
|
kbdtype = arg |
550 |
|
|
elif (str == '--virtpconsole'): |
551 |
|
|
flags.virtpconsole = arg |
552 |
|
|
elif (str == '--headless'): |
553 |
|
|
isHeadless = 1 |
554 |
|
|
elif (str == '--vnc'): |
555 |
|
|
flags.usevnc = 1 |
556 |
|
|
|
557 |
|
|
# see if there is a vnc password file |
558 |
|
|
try: |
559 |
|
|
pfile = open("/tmp/vncpassword.dat", "r") |
560 |
|
|
vncpassword=pfile.readline().strip() |
561 |
|
|
pfile.close() |
562 |
|
|
os.unlink("/tmp/vncpassword.dat") |
563 |
|
|
except: |
564 |
|
|
vncpassword=None |
565 |
|
|
pass |
566 |
|
|
|
567 |
|
|
# check length of vnc password |
568 |
|
|
if vncpassword is not None and len(vncpassword) < 6: |
569 |
|
|
from snack import * |
570 |
|
|
|
571 |
|
|
screen = SnackScreen() |
572 |
|
|
ButtonChoiceWindow(screen, _('VNC Password Error'), |
573 |
|
|
_('You need to specify a vnc password of at least 6 characters long.\n\n' |
574 |
|
|
'Press <return> to reboot your system.\n'), |
575 |
|
|
buttons = (_("OK"),)) |
576 |
|
|
screen.finish() |
577 |
|
|
sys.exit(0) |
578 |
|
|
elif (str == '--vncconnect'): |
579 |
|
|
cargs = string.split(arg, ":") |
580 |
|
|
vncconnecthost = cargs[0] |
581 |
|
|
if len(cargs) > 1: |
582 |
|
|
if len(cargs[1]) > 0: |
583 |
|
|
vncconnectport = cargs[1] |
584 |
|
|
|
585 |
|
|
# set up anaconda logging |
586 |
|
|
anaconda_log.open (logFile) |
587 |
|
|
log.handler=anaconda_log |
588 |
|
|
|
589 |
|
|
# |
590 |
|
|
# must specify install, rescue mode |
591 |
|
|
# |
592 |
|
|
|
593 |
|
|
if (progmode == 'rescue'): |
594 |
|
|
if (not method): |
595 |
|
|
sys.stderr.write('--method required for rescue mode\n') |
596 |
|
|
sys.exit(1) |
597 |
|
|
|
598 |
|
|
import rescue, instdata, configFileData |
599 |
|
|
|
600 |
|
|
configFile = configFileData.configFileData() |
601 |
|
|
configFileData = configFile.getConfigData() |
602 |
|
|
|
603 |
|
|
id = instdata.InstallData([], "fd0", configFileData, method) |
604 |
|
|
rescue.runRescue(rootPath, not rescue_nomount, id) |
605 |
|
|
|
606 |
|
|
# shouldn't get back here |
607 |
|
|
sys.exit(1) |
608 |
|
|
else: |
609 |
|
|
if (not method): |
610 |
|
|
sys.stderr.write('no install method specified\n') |
611 |
|
|
sys.exit(1) |
612 |
|
|
|
613 |
|
|
# |
614 |
|
|
# Here we have a hook to pull in second half of kickstart file via https |
615 |
|
|
# if desired. |
616 |
|
|
# |
617 |
|
|
if ksfile is not None: |
618 |
|
|
from kickstart import pullRemainingKickstartConfig, KSAppendException |
619 |
|
|
from kickstart import parseKickstartVNC |
620 |
|
|
|
621 |
|
|
try: |
622 |
|
|
rc=pullRemainingKickstartConfig(ksfile) |
623 |
|
|
except KSAppendException, msg: |
624 |
|
|
rc = msg |
625 |
|
|
except: |
626 |
|
|
rc = _("Unknown Error") |
627 |
|
|
|
628 |
|
|
if rc is not None: |
629 |
|
|
dup_log(_("Error pulling second part of kickstart config: %s!") % (rc,)) |
630 |
|
|
sys.exit(1) |
631 |
|
|
|
632 |
|
|
# now see if they enabled vnc via the kickstart file. Note that command |
633 |
|
|
# line options for password, connect host and port override values in |
634 |
|
|
# kickstart file |
635 |
|
|
(ksusevnc, ksvncpasswd, ksvnchost, ksvncport) = parseKickstartVNC(ksfile) |
636 |
|
|
|
637 |
|
|
if ksusevnc: |
638 |
|
|
flags.usevnc = 1 |
639 |
|
|
|
640 |
|
|
if vncpassword == None: |
641 |
|
|
vncpassword = ksvncpasswd |
642 |
|
|
|
643 |
|
|
if vncconnecthost == None: |
644 |
|
|
vncconnecthost = ksvnchost |
645 |
|
|
|
646 |
|
|
if vncconnectport == None: |
647 |
|
|
vncconnectport = ksvncport |
648 |
|
|
|
649 |
|
|
# |
650 |
|
|
# Determine install method - GUI or TUI |
651 |
|
|
# |
652 |
|
|
# use GUI by default except for install methods that were traditionally |
653 |
|
|
# text based due to the requirement of a small stage 2 |
654 |
|
|
# |
655 |
|
|
# if display_mode wasnt set by command line parameters then set default |
656 |
|
|
# |
657 |
|
|
|
658 |
|
|
if display_mode is None: |
659 |
|
|
if (method and |
660 |
|
|
method.startswith('ftp://') or |
661 |
|
|
method.startswith('http://')): |
662 |
|
|
display_mode = 't' |
663 |
|
|
else: |
664 |
|
|
display_mode = 'g' |
665 |
|
|
|
666 |
|
|
if (debug): |
667 |
|
|
import pdb |
668 |
|
|
pdb.set_trace() |
669 |
|
|
|
670 |
|
|
# let people be stupid |
671 |
|
|
## # don't let folks do anything stupid on !s390 |
672 |
|
|
## if (not flags.test and os.getpid() > 90 and flags.setupFilesystems and |
673 |
|
|
## not iutil.getArch() == "s390"): |
674 |
|
|
## sys.stderr.write( |
675 |
|
|
## "You're running me on a live system! that's incredibly stupid.\n") |
676 |
|
|
## sys.exit(1) |
677 |
|
|
|
678 |
|
|
import isys |
679 |
|
|
import instdata |
680 |
|
|
import floppy |
681 |
|
|
import vnc |
682 |
|
|
|
683 |
|
|
if not isHeadless: |
684 |
|
|
try: |
685 |
|
|
import xsetup |
686 |
|
|
import rhpl.xhwstate as xhwstate |
687 |
|
|
except ImportError: |
688 |
|
|
isHeadless = 1 |
689 |
|
|
import rhpl.keyboard as keyboard |
690 |
|
|
|
691 |
|
|
# handle traceonly and exit |
692 |
|
|
if traceOnly: |
693 |
|
|
|
694 |
|
|
if display_mode == 'g': |
695 |
|
|
sys.stderr.write("traceonly is only supported for text mode\n") |
696 |
|
|
sys.exit(0) |
697 |
|
|
|
698 |
|
|
# prints a list of all the modules imported |
699 |
|
|
from text import InstallInterface |
700 |
|
|
from text import stepToClasses |
701 |
|
|
import pdb |
702 |
|
|
import warnings |
703 |
|
|
import image |
704 |
|
|
import harddrive |
705 |
|
|
import urlinstall |
706 |
|
|
import mimetools |
707 |
|
|
import mimetypes |
708 |
|
|
import syslogd |
709 |
|
|
import installclass |
710 |
|
|
import re |
711 |
|
|
import rescue |
712 |
|
|
import configFileData |
713 |
|
|
import kickstart |
714 |
|
|
import whiteout |
715 |
|
|
import findpackageset |
716 |
|
|
import libxml2 |
717 |
|
|
import cmdline |
718 |
|
|
import encodings.utf_8 |
719 |
|
|
|
720 |
|
|
installclass.availableClasses() |
721 |
|
|
|
722 |
|
|
if display_mode == 't': |
723 |
|
|
for step in stepToClasses.keys(): |
724 |
|
|
if stepToClasses[step]: |
725 |
|
|
(mod, klass) = stepToClasses[step] |
726 |
|
|
exec "import %s" % mod |
727 |
|
|
|
728 |
|
|
for module in sys.__dict__['modules'].keys (): |
729 |
|
|
if module not in [ "__builtin__", "__main__" ]: |
730 |
|
|
foo = repr (sys.__dict__['modules'][module]) |
731 |
|
|
bar = string.split (foo, "'") |
732 |
|
|
if len (bar) > 3: |
733 |
|
|
print bar[3] |
734 |
|
|
|
735 |
|
|
sys.exit(0) |
736 |
|
|
|
737 |
|
|
log("Display mode = %s", display_mode) |
738 |
|
|
log("Method = %s", method) |
739 |
|
|
|
740 |
|
|
# |
741 |
|
|
# override display mode if machine cannot nicely run X |
742 |
|
|
# |
743 |
|
|
if (not flags.test): |
744 |
|
|
if (iutil.memInstalled() < isys.MIN_GUI_RAM): |
745 |
|
|
dup_log(_("You do not have enough RAM to use the graphical " |
746 |
|
|
"installer. Starting text mode.")) |
747 |
|
|
display_mode = 't' |
748 |
|
|
time.sleep(2) |
749 |
|
|
|
750 |
|
|
|
751 |
|
|
if iutil.memInstalled() < isys.MIN_RAM: |
752 |
|
|
from snack import * |
753 |
|
|
|
754 |
|
|
screen = SnackScreen() |
755 |
|
|
ButtonChoiceWindow(screen, _('Fatal Error'), |
756 |
|
|
_('You do not have enough RAM to install Red Hat ' |
757 |
|
|
'Linux on this machine.\n' |
758 |
|
|
'\n' |
759 |
|
|
'Press <return> to reboot your system.\n'), |
760 |
|
|
buttons = (_("OK"),)) |
761 |
|
|
screen.finish() |
762 |
|
|
sys.exit(0) |
763 |
|
|
|
764 |
|
|
# |
765 |
|
|
# handle class passed from loader |
766 |
|
|
# |
767 |
|
|
if customClass: |
768 |
|
|
import installclass |
769 |
|
|
|
770 |
|
|
classes = installclass.availableClasses(showHidden=1) |
771 |
|
|
for (className, objectClass, logo) in classes: |
772 |
|
|
if className == customClass: |
773 |
|
|
instClass = objectClass(flags.expert) |
774 |
|
|
|
775 |
|
|
if not instClass: |
776 |
|
|
sys.stderr.write("installation class %s not available\n" % customClass) |
777 |
|
|
sys.stderr.write("\navailable classes:\n") |
778 |
|
|
for (className, objectClass, logo) in classes: |
779 |
|
|
sys.stderr.write("\t%s\n" % className) |
780 |
|
|
sys.exit(1) |
781 |
|
|
|
782 |
|
|
# |
783 |
|
|
# if no instClass declared by user figure it out based on other cmdline args |
784 |
|
|
# |
785 |
|
|
if not instClass: |
786 |
|
|
from installclass import DefaultInstall, availableClasses |
787 |
|
|
instClass = DefaultInstall(flags.expert) |
788 |
|
|
|
789 |
|
|
if len(availableClasses(showHidden = 1)) < 2: |
790 |
|
|
(cname, cobject, clogo) = availableClasses(showHidden = 1)[0] |
791 |
|
|
log("%s is only installclass, using it" %(cname,)) |
792 |
|
|
instClass = cobject(flags.expert) |
793 |
|
|
|
794 |
|
|
|
795 |
|
|
# this lets install classes force text mode instlls |
796 |
|
|
if instClass.forceTextMode: |
797 |
|
|
dup_log(_("Install class forcing text mode installation")) |
798 |
|
|
display_mode = 't' |
799 |
|
|
|
800 |
|
|
# |
801 |
|
|
# find out what video hardware is available to run installer |
802 |
|
|
# |
803 |
|
|
|
804 |
|
|
# XXX kind of hacky - need to remember if we're running on an existing |
805 |
|
|
# X display later to avoid some initilization steps |
806 |
|
|
if os.environ.has_key('DISPLAY') and display_mode == 'g': |
807 |
|
|
x_already_set = 1 |
808 |
|
|
else: |
809 |
|
|
x_already_set = 0 |
810 |
|
|
|
811 |
|
|
if not isHeadless: |
812 |
|
|
# |
813 |
|
|
# Probe what is available for X and setup a hardware state |
814 |
|
|
# |
815 |
|
|
# try to probe interesting hw |
816 |
|
|
import rhpl.xserver as xserver |
817 |
|
|
skipddcprobe = (skipddc or (x_already_set and flags.test)) |
818 |
|
|
skipmouseprobe = not (not os.environ.has_key('DISPLAY') or flags.setupFilesystems) |
819 |
|
|
|
820 |
|
|
(videohw, monitorhw, mousehw) = xserver.probeHW(skipDDCProbe=skipddcprobe, |
821 |
|
|
skipMouseProbe = skipmouseprobe) |
822 |
|
|
# if the len(videocards) is zero, then let's assume we're isHeadless |
823 |
|
|
if len(videohw.videocards) == 0: |
824 |
|
|
print _("No video hardware found, assuming headless") |
825 |
|
|
videohw = None |
826 |
|
|
monitorhw = None |
827 |
|
|
mousehw = None |
828 |
|
|
isHeadless = 1 |
829 |
|
|
else: |
830 |
|
|
# setup a X hw state for use later with configuration. |
831 |
|
|
try: |
832 |
|
|
xcfg = xhwstate.XF86HardwareState(defcard=videohw, |
833 |
|
|
defmon=monitorhw) |
834 |
|
|
except Exception, e: |
835 |
|
|
print _("Unable to instantiate a X hardware state object.") |
836 |
|
|
xcfg = None |
837 |
|
|
else: |
838 |
|
|
videohw = None |
839 |
|
|
monitorhw = None |
840 |
|
|
mousehw = None |
841 |
|
|
xcfg = None |
842 |
|
|
|
843 |
|
|
# keyboard |
844 |
|
|
kbd = keyboard.Keyboard() |
845 |
|
|
if keymap: |
846 |
|
|
kbd.set(keymap) |
847 |
|
|
|
848 |
|
|
# |
849 |
|
|
# delay to let use see status of attempt to probe hw |
850 |
|
|
# |
851 |
|
|
time.sleep(3) |
852 |
|
|
|
853 |
|
|
|
854 |
|
|
# |
855 |
|
|
# now determine if we're going to run in GUI or TUI mode |
856 |
|
|
# |
857 |
|
|
# if no X server, we have to use text mode |
858 |
|
|
if not (flags.test or flags.rootpath) and (iutil.getArch() != "s390" and not os.access("/mnt/runtime/usr/X11R6/bin/Xorg", os.X_OK)): |
859 |
|
|
dup_log(_("Graphical installation not available... " |
860 |
|
|
"Starting text mode.")) |
861 |
|
|
time.sleep(2) |
862 |
|
|
display_mode = 't' |
863 |
|
|
|
864 |
|
|
if not isHeadless: |
865 |
|
|
# if no mouse we force text mode |
866 |
|
|
mousedev = mousehw.get() |
867 |
|
|
if ksfile is None and not flags.usevnc and not os.environ.has_key("DISPLAY") and display_mode == 'g' and mousedev[0] == "No - mouse": |
868 |
|
|
# ask for the mouse type |
869 |
|
|
import rhpl.mouse as mouse |
870 |
|
|
|
871 |
|
|
while 1: |
872 |
|
|
mouserc = mouse.mouseWindow(mousehw) |
873 |
|
|
if mouserc == 0: |
874 |
|
|
dup_log(_("No mouse was detected. A mouse is required for " |
875 |
|
|
"graphical installation. Starting text mode.")) |
876 |
|
|
display_mode = 't' |
877 |
|
|
time.sleep(2) |
878 |
|
|
break |
879 |
|
|
elif mouserc == -1: |
880 |
|
|
# rescan |
881 |
|
|
mousehw.probe() |
882 |
|
|
mousedev = mousehw.get() |
883 |
|
|
if mousedev[0] != "No - mouse": |
884 |
|
|
dup_log(_("Detected mouse type: %s"), mousehw.shortDescription()) |
885 |
|
|
time.sleep(5) |
886 |
|
|
break |
887 |
|
|
else: |
888 |
|
|
dup_log(_("Using mouse type: %s"), mousehw.shortDescription()) |
889 |
|
|
break |
890 |
|
|
|
891 |
|
|
|
892 |
|
|
else: # s390/iSeries checks |
893 |
|
|
if display_mode == 'g' and not (os.environ.has_key('DISPLAY') or |
894 |
|
|
flags.usevnc): |
895 |
|
|
dup_log("DISPLAY variable not set. Starting text mode!") |
896 |
|
|
display_mode = 't' |
897 |
|
|
graphical_failed = 1 |
898 |
|
|
time.sleep(2) |
899 |
|
|
|
900 |
|
|
# if DISPLAY not set either vnc server failed to start or we're not |
901 |
|
|
# running on a redirected X display, so start local X server |
902 |
|
|
if display_mode == 'g' and not os.environ.has_key('DISPLAY') and not flags.usevnc: |
903 |
|
|
import rhpl.monitor as monitor |
904 |
|
|
|
905 |
|
|
# if no monitor probed lets guess based on runres |
906 |
|
|
hsync = monitorhw.getMonitorHorizSync() |
907 |
|
|
vsync = monitorhw.getMonitorVertSync() |
908 |
|
|
res_supported = monitor.monitor_supports_mode(hsync, vsync, runres) |
909 |
|
|
|
910 |
|
|
if not res_supported: |
911 |
|
|
import rhpl.guesslcd as guesslcd |
912 |
|
|
|
913 |
|
|
# pick a monitor spec that is adequate for requested runres |
914 |
|
|
(hsync, vsync) = guesslcd.getSyncForRes(runres) |
915 |
|
|
monitorhw.setSpecs(hsync, vsync) |
916 |
|
|
|
917 |
|
|
# recreate X config object |
918 |
|
|
xcfg = xhwstate.XF86HardwareState(defcard=videohw, |
919 |
|
|
defmon=monitorhw) |
920 |
|
|
xcfg.set_resolution(runres) |
921 |
|
|
|
922 |
|
|
# make sure we can write log to ramfs |
923 |
|
|
if os.access("/tmp/ramfs", os.W_OK): |
924 |
|
|
xlogfile = "/tmp/ramfs/X.log" |
925 |
|
|
else: |
926 |
|
|
xlogfile = None |
927 |
|
|
|
928 |
|
|
xsetup_failed = xserver.startXServer(videohw, monitorhw, mousehw, kbd, |
929 |
|
|
runres, |
930 |
|
|
xStartedCB=doStartupX11Actions, |
931 |
|
|
xQuitCB=doShutdownX11Actions, |
932 |
|
|
logfile=xlogfile) |
933 |
|
|
|
934 |
|
|
if xsetup_failed: |
935 |
|
|
dup_log(" X startup failed, falling back to text mode") |
936 |
|
|
display_mode = 't' |
937 |
|
|
graphical_failed = 1 |
938 |
|
|
time.sleep(2) |
939 |
|
|
|
940 |
|
|
if display_mode == 't' and graphical_failed: |
941 |
|
|
ret = vnc.askVncWindow() |
942 |
|
|
if ret != -1: |
943 |
|
|
display_mode = 'g' |
944 |
|
|
flags.usevnc = 1 |
945 |
|
|
if ret is not None: |
946 |
|
|
vncpassword = ret |
947 |
|
|
|
948 |
|
|
# if they want us to use VNC do that now |
949 |
|
|
if display_mode == 'g' and flags.usevnc: |
950 |
|
|
# dont run vncpassword if in test mode |
951 |
|
|
if flags.test: |
952 |
|
|
vncpassword = None |
953 |
|
|
|
954 |
|
|
startVNCServer(vncpassword=vncpassword, |
955 |
|
|
vncconnecthost=vncconnecthost, |
956 |
|
|
vncconnectport=vncconnectport) |
957 |
|
|
|
958 |
|
|
|
959 |
|
|
# |
960 |
|
|
# read in anaconda configuration file |
961 |
|
|
# |
962 |
|
|
import configFileData |
963 |
|
|
configFile = configFileData.configFileData() |
964 |
|
|
configFileData = configFile.getConfigData() |
965 |
|
|
|
966 |
|
|
# setup links required for all install types |
967 |
|
|
for i in ( "services", "protocol", "nsswitch.conf", "joe", "selinux"): |
968 |
|
|
try: |
969 |
|
|
os.symlink ("../mnt/runtime/etc/" + i, "/etc/" + i) |
970 |
|
|
except: |
971 |
|
|
pass |
972 |
|
|
|
973 |
|
|
# |
974 |
|
|
# setup links required by graphical mode if installing and verify display mode |
975 |
|
|
# |
976 |
|
|
if (display_mode == 'g'): |
977 |
|
|
print _("Starting graphical installation...") |
978 |
|
|
if not flags.test and flags.setupFilesystems: |
979 |
|
|
for i in ( "imrc", "im_palette.pal", "gtk-2.0", "pango", "fonts", |
980 |
|
|
"fb.modes"): |
981 |
|
|
try: |
982 |
|
|
if os.path.exists("/mnt/runtime/etc/%s" %(i,)): |
983 |
|
|
os.symlink ("../mnt/runtime/etc/" + i, "/etc/" + i) |
984 |
|
|
except: |
985 |
|
|
pass |
986 |
|
|
|
987 |
|
|
# display splash screen |
988 |
|
|
|
989 |
|
|
if nofallback: |
990 |
|
|
from splashscreen import splashScreenShow |
991 |
|
|
splashScreenShow(configFileData) |
992 |
|
|
|
993 |
|
|
from gui import InstallInterface |
994 |
|
|
else: |
995 |
|
|
try: |
996 |
|
|
from splashscreen import splashScreenShow |
997 |
|
|
splashScreenShow(configFileData) |
998 |
|
|
|
999 |
|
|
from gui import InstallInterface |
1000 |
|
|
except Exception, e: |
1001 |
|
|
log("Exception starting GUI installer: %s" %(e,)) |
1002 |
|
|
# if we're not going to really go into GUI mode, we need to get |
1003 |
|
|
# back to vc1 where the text install is going to pop up. |
1004 |
|
|
if not x_already_set: |
1005 |
|
|
isys.vtActivate (1) |
1006 |
|
|
dup_log("GUI installer startup failed, falling back to text mode.") |
1007 |
|
|
display_mode = 't' |
1008 |
|
|
if 'DISPLAY' in os.environ.keys(): |
1009 |
|
|
del os.environ['DISPLAY'] |
1010 |
|
|
time.sleep(2) |
1011 |
|
|
|
1012 |
|
|
if (display_mode == 't'): |
1013 |
|
|
from text import InstallInterface |
1014 |
|
|
|
1015 |
|
|
if (display_mode == 'c'): |
1016 |
|
|
from cmdline import InstallInterface |
1017 |
|
|
|
1018 |
|
|
|
1019 |
|
|
# go ahead and set up the interface |
1020 |
|
|
intf = InstallInterface () |
1021 |
|
|
|
1022 |
|
|
# imports after setting up the path |
1023 |
|
|
if method: |
1024 |
|
|
if method.startswith('cdrom://'): |
1025 |
|
|
from image import CdromInstallMethod |
1026 |
|
|
methodobj = CdromInstallMethod(method[8:], intf.messageWindow, |
1027 |
|
|
intf.progressWindow, rootPath) |
1028 |
|
|
elif method.startswith('nfs:/'): |
1029 |
|
|
from image import NfsInstallMethod |
1030 |
|
|
methodobj = NfsInstallMethod(method[5:], rootPath) |
1031 |
|
|
elif method.startswith('nfsiso:/'): |
1032 |
|
|
from image import NfsIsoInstallMethod |
1033 |
|
|
methodobj = NfsIsoInstallMethod(method[8:], intf.messageWindow, rootPath) |
1034 |
|
|
elif method.startswith('ftp://') or method.startswith('http://'): |
1035 |
|
|
from urlinstall import UrlInstallMethod |
1036 |
|
|
methodobj = UrlInstallMethod(method, rootPath) |
1037 |
|
|
methodobj.setIntf(intf) |
1038 |
|
|
elif method.startswith('hd://'): |
1039 |
|
|
tmpmethod = method[5:] |
1040 |
|
|
|
1041 |
|
|
i = string.index(tmpmethod, ":") |
1042 |
|
|
drive = tmpmethod[0:i] |
1043 |
|
|
tmpmethod = tmpmethod[i+1:] |
1044 |
|
|
|
1045 |
|
|
i = string.index(tmpmethod, "/") |
1046 |
|
|
type = tmpmethod[0:i] |
1047 |
|
|
dir = tmpmethod[i+1:] |
1048 |
|
|
|
1049 |
|
|
from harddrive import HardDriveInstallMethod |
1050 |
|
|
methodobj = HardDriveInstallMethod(drive, type, dir, intf.messageWindow, |
1051 |
|
|
rootPath) |
1052 |
|
|
elif method.startswith('oldhd://'): |
1053 |
|
|
tmpmethod = method[8:] |
1054 |
|
|
|
1055 |
|
|
i = string.index(tmpmethod, ":") |
1056 |
|
|
drive = tmpmethod[0:i] |
1057 |
|
|
tmpmethod = tmpmethod[i+1:] |
1058 |
|
|
|
1059 |
|
|
i = string.index(tmpmethod, "/") |
1060 |
|
|
type = tmpmethod[0:i] |
1061 |
|
|
dir = tmpmethod[i+1:] |
1062 |
|
|
|
1063 |
|
|
from harddrive import OldHardDriveInstallMethod |
1064 |
|
|
methodobj = OldHardDriveInstallMethod(drive, type, dir, rootPath) |
1065 |
|
|
else: |
1066 |
|
|
print "unknown install method:", method |
1067 |
|
|
sys.exit(1) |
1068 |
|
|
|
1069 |
|
|
floppyDevice = floppy.probeFloppyDevice() |
1070 |
|
|
|
1071 |
|
|
# create device nodes for detected devices if we're not running in test mode |
1072 |
|
|
if not flags.test and flags.setupFilesystems: |
1073 |
|
|
iutil.makeDriveDeviceNodes() |
1074 |
|
|
|
1075 |
|
|
id = instClass.installDataClass(extraModules, floppyDevice, configFileData, method) |
1076 |
|
|
|
1077 |
|
|
id.x_already_set = x_already_set |
1078 |
|
|
|
1079 |
|
|
if mousehw: |
1080 |
|
|
id.setMouse(mousehw) |
1081 |
|
|
|
1082 |
|
|
if videohw: |
1083 |
|
|
id.setVideoCard(videohw) |
1084 |
|
|
|
1085 |
|
|
if monitorhw: |
1086 |
|
|
id.setMonitor(monitorhw) |
1087 |
|
|
|
1088 |
|
|
# |
1089 |
|
|
# not sure what to do here - somehow we didnt detect anything |
1090 |
|
|
# |
1091 |
|
|
if xcfg is None and not isHeadless: |
1092 |
|
|
try: |
1093 |
|
|
xcfg = xhwstate.XF86HardwareState() |
1094 |
|
|
except Exception, e: |
1095 |
|
|
print _("Unable to instantiate a X hardware state object.") |
1096 |
|
|
xcfg = None |
1097 |
|
|
|
1098 |
|
|
if xcfg is not None: |
1099 |
|
|
# |
1100 |
|
|
# XXX - hack - here we want to enforce frame buffer requirement on ppc |
1101 |
|
|
# pick 640x480x8bpp cause that is what frame buffer inits to |
1102 |
|
|
# when the machine reboots |
1103 |
|
|
if iutil.getArch() == "ppc": |
1104 |
|
|
cardname = "Framebuffer driver (generic)" |
1105 |
|
|
xcfg.set_videocard_card(cardname) |
1106 |
|
|
xcfg.set_videocard_name(cardname) |
1107 |
|
|
xcfg.set_colordepth(8) |
1108 |
|
|
xcfg.set_resolution("640x480") |
1109 |
|
|
|
1110 |
|
|
xsetup = xsetup.XSetup(xcfg) |
1111 |
|
|
|
1112 |
|
|
# HACK - if user overrides resolution then use it and disable |
1113 |
|
|
# choosing a sane default for them |
1114 |
|
|
if runres_override: |
1115 |
|
|
xsetup.imposed_sane_default = 1 |
1116 |
|
|
|
1117 |
|
|
id.setXSetup(xsetup) |
1118 |
|
|
|
1119 |
|
|
if kbd: |
1120 |
|
|
id.setKeyboard(kbd) |
1121 |
|
|
|
1122 |
|
|
instClass.setInstallData(id) |
1123 |
|
|
|
1124 |
|
|
dispatch = dispatch.Dispatcher(intf, id, methodobj, rootPath) |
1125 |
|
|
|
1126 |
|
|
if lang: |
1127 |
|
|
dispatch.skipStep("language", permanent = 1) |
1128 |
|
|
instClass.setLanguage(id, lang) |
1129 |
|
|
|
1130 |
|
|
if keymap: |
1131 |
|
|
dispatch.skipStep("keyboard", permanent = 1) |
1132 |
|
|
instClass.setKeyboard(id, keymap) |
1133 |
|
|
|
1134 |
|
|
# Skip the disk options in rootpath mode |
1135 |
|
|
if flags.rootpath: |
1136 |
|
|
dispatch.skipStep("partitionmethod", permanent = 1) |
1137 |
|
|
dispatch.skipStep("partitionmethodsetup", permanent = 1) |
1138 |
|
|
dispatch.skipStep("autopartition", permanent = 1) |
1139 |
|
|
dispatch.skipStep("autopartitionexecute", permanent = 1) |
1140 |
|
|
dispatch.skipStep("fdisk", permanent = 1) |
1141 |
|
|
dispatch.skipStep("bootloadersetup", permanent = 1) |
1142 |
|
|
dispatch.skipStep("bootloader", permanent = 1) |
1143 |
|
|
dispatch.skipStep("bootloaderadvanced", permanent = 1) |
1144 |
|
|
dispatch.skipStep("upgbootloader", permanent = 1) |
1145 |
|
|
|
1146 |
|
|
# set up the headless case |
1147 |
|
|
if isHeadless == 1: |
1148 |
|
|
id.setHeadless(isHeadless) |
1149 |
|
|
instClass.setAsHeadless(dispatch, isHeadless) |
1150 |
|
|
|
1151 |
|
|
instClass.setSteps(dispatch) |
1152 |
|
|
|
1153 |
|
|
# We shouldn't need this again |
1154 |
|
|
# XXX |
1155 |
|
|
#del id |
1156 |
|
|
|
1157 |
|
|
# |
1158 |
|
|
# XXX This is surely broken |
1159 |
|
|
# |
1160 |
|
|
#if iutil.getArch() == "sparc": |
1161 |
|
|
# import kudzu |
1162 |
|
|
# mice = kudzu.probe (kudzu.CLASS_MOUSE, kudzu.BUS_UNSPEC, kudzu.PROBE_ONE); |
1163 |
|
|
# if mice: |
1164 |
|
|
# (mouseDev, driver, descr) = mice[0] |
1165 |
|
|
# if mouseDev == 'sunmouse': |
1166 |
|
|
# instClass.addToSkipList("mouse") |
1167 |
|
|
# instClass.setMouseType("Sun - Mouse", "sunmouse") |
1168 |
|
|
|
1169 |
|
|
# comment out the next line to make exceptions non-fatal |
1170 |
|
|
sys.excepthook = lambda type, value, tb, dispatch=dispatch, intf=intf: handleException(dispatch, intf, (type, value, tb)) |
1171 |
|
|
|
1172 |
|
|
try: |
1173 |
|
|
intf.run(id, dispatch, configFileData) |
1174 |
|
|
except SystemExit, code: |
1175 |
|
|
intf.shutdown() |
1176 |
|
|
except: |
1177 |
|
|
handleException(dispatch, intf, sys.exc_info()) |
1178 |
|
|
|
1179 |
|
|
del intf |