summaryrefslogtreecommitdiffstats
path: root/anaconda
blob: 7b5240c7e88d2ae85b232a112e059c714d7e6ad8 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/usr/bin/python

import sys, getopt, os
import gettext

gettext.bindtextdomain("anaconda", "/usr/share/locale")
gettext.textdomain("anaconda")
_ = gettext.gettext

(args, extra) = getopt.getopt(sys.argv[1:], 'p:GTtdr:f', 
          [ 'gui', 'text', 'test', 'debug', 'rootpath=', 
	    'testpath=', 'mountfs' ])

# remove the arguments - gnome_init doesn't understand them
for arg in sys.argv[1:]:
    sys.argv.remove (arg)
sys.argc = 1

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

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'
	serverPath = '/usr/X11R6/bin/XF86_SVGA'

    isys.makeDevInode("psaux", "psaux")

    f = open ('/tmp/XF86Config', 'w')
    f.write ("""
Section "Files"
    RgbPath	"/usr/X11R6/lib/X11/rgb"
    FontPath	"/usr/X11R6/lib/X11/fonts/misc/"
    FontPath	"/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath	"/usr/X11R6/lib/X11/fonts/Speedo/"
    FontPath	"/usr/X11R6/lib/X11/fonts/75dpi/"
    FontPath	"/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

Section "ServerFlags"
EndSection

Section "Keyboard"
    Protocol    "Standard"
    AutoRepeat  500 5
    LeftAlt     Meta
    RightAlt    Meta
    ScrollLock  Compose
    RightCtl    Control
    XkbKeymap       "xfree86(us)"
    XkbKeycodes     "xfree86"
    XkbTypes        "default"
    XkbCompat       "default"
    XkbSymbols      "us(pc101)"
    XkbGeometry     "pc"
    XkbRules        "xfree86"
    XkbModel        "pc101"
    XkbLayout       "us"
EndSection

Section "Pointer"
    Protocol    "ps/2"
    Device      "/psaux"
    Emulate3Buttons
    Emulate3Timeout    50
EndSection

Section "Monitor"
    Identifier  "Monitor"
    VendorName  "Vendor"
    ModelName   "Model"
    HorizSync   31.5 - 79.0
    VertRefresh 40-150

# XXX fix me descr
Modeline "640x480"     25.175 640  664  760  800   480  491  493  525
# 640x480 @ 72 Hz, 36.5 kHz hsync
Modeline "640x480"     31.5   640  680  720  864   480  488  491  521
# 640x480 @ 75 Hz, 37.50 kHz hsync
ModeLine  "640x480"    31.5   640  656  720  840   480  481  484  500 -HSync -VSync

EndSection

Section "Device"
    Identifier  "Device"
    VendorName  "Vendor"
    BoardName   "Board"
EndSection

Section "Screen"
    Driver      "vga16"
    Device      "Device"
    Monitor     "Monitor"
    Subsection "Display"
        Modes       "640x480"
        ViewPort    0 0
    EndSubsection
EndSection

Section "Screen"
    Driver      "svga"
    Device      "Device"
    Monitor     "Monitor"
    Subsection "Display"
        Depth       8
        Modes       "640x480"
        ViewPort    0 0
        Virtual     640 480
    EndSubsection
EndSection

Section "Screen"
    Driver      "fbdev"
    Device      "Device"
    Monitor     "Monitor"
    Subsection "Display"
	Depth 	    16
        Modes       "default"
    EndSubsection
EndSection
""")
    f.close ()

    server = os.fork()
    if (not server):
	os.execv(serverPath, [serverPath, ':1', '-xf86config', 
                 '/tmp/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

try:
    todo = ToDo(intf, method, rootPath, installSystem = installPackages,
                setupFilesystems = setupFilesystems)
    intf.run(todo)
    todo.doInstall(intf)
    intf.messageWindow (_("Complete"), 
                        _("Congratulations, installation is complete.\n\n"
                          "Remove the boot media and "
                          "press return to reboot. For information on fixes which are "
                          "available for this release of Red Hat Linux, consult the "
                          "Errata available from http://www.redhat.com.\n\n"
                          "Information on configuring your system is available in the post "
                          "install chapter of the Official Red Hat Linux User's Guide."))

except:
    exc = sys.exc_info()
    intf.exceptionWindow (exc)
    os._exit (1)

del intf