summaryrefslogtreecommitdiffstats
path: root/anaconda
blob: 308dd69baa942b2b6f92f32fdba7e1158f539b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/python

import sys, getopt, os
import lang

_=lang.gettext 

# fixme - first stage install passes --method
(args, extra) = getopt.getopt(sys.argv[1:], 'p:gTtdr:f', 
          [ 'gui', 'text', 'test', 'debug', 'rootpath=', 
	    'testpath=', 'mountfs', 'method' ])

mode = None
test = 0
debug = 0
rootPath = '/mnt/sysimage'
localInstall = 0
forceMount = 0

for n in args:
    (str, arg) = n
    if (str == '-g' or str == '--gui'):
	mode = 'g'
    elif (str == '-T' or str == '--text'):
	mode = 't'
    elif (str == '-t' or str == '--test'):
	test = 1
    elif (str == '-d' or str == '--debug'):
	debug = 1
    elif (str == '-r' or str == '--rootpath'):
	rootPath = arg
	localInstall = 1
    elif (str == '-p' or str == '--imagepath'):
	imagepath = arg
    elif (str == '--mountfs'):
	forceMount = 1

if (debug):
    import pdb
    pdb.set_trace()

if (not test and not localInstall and os.getpid() > 50):
    print _("you're running me on a live system! that's incredibly stupid.")
    sys.exit(1)

if (os.path.exists('rpmmodule')):
    sys.path.append('balkan')
    sys.path.append('rpmmodule')
    sys.path.append('isys')
elif (mode == None):
    try:
        f = open('/dev/fb0', 'r')
	f.close()
	mode = 'g'
    except:
	mode = 't'

# imports after setting up the path
from image import InstallMethod
import rpm
import lilo
from todo import ToDo
import isys

if (mode == 'g' and not os.environ.has_key('DISPLAY')):
    os.environ['DISPLAY'] = ':1'
    serverPath = None

    try:
        f = open('/dev/fb0', 'r')
	f.close()
        serverPath = '/usr/X11R6/bin/XF86_FBDev'
    except:
	serverPath = '/usr/X11R6/bin/XF86_VGA16'

    server = os.fork()
    if (not server):
	os.execv(serverPath, [serverPath, ':1', '-xf86config', 
                 imagepath + '/RedHat/instimage/etc/X11/XF86Config'])
    child = os.fork()
    if (child):
	os.waitpid(child, 0)
	os.kill(server, 15)
	sys.exit(0)

if (mode == 'g'):
    from gui import InstallInterface
elif (mode == 't'):
    from text import InstallInterface
else:
    print "No mode was specified"
    sys.exit(1)

method = InstallMethod(imagepath)

intf = InstallInterface()

# set the default actions
installPackages = 1
setupFilesystems = 1

if localInstall:
    installPackages = 1
    setupFilesystems = 0
if test:
    installPackages = 0
    setupFilesystems = 0
if forceMount:
    setupFilesystems = 1

todo = ToDo(intf, method, rootPath, installSystem = installPackages,
	    setupFilesystems = setupFilesystems)

intf.run(todo)
todo.doInstall()

del intf