summaryrefslogtreecommitdiffstats
path: root/anaconda
blob: f12ce4520a8cdf70dea082d15bb6b9db37462ed3 (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
#!/usr/bin/python

import sys, getopt, os

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

mode = None
test = 0
force = 0
debug = 0
rootPath = '/mnt'
runLive = 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
	runLive = 1
    elif (str == '-p' or str == '--imagepath'):
	imagepath = arg
    elif (str == '--force'):
	force = 1

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

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

if (test):
    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'] = ':0'
    server = os.fork()
    if (not server):
	os.execv('/usr/X11R6/bin/XF86_FBDev', ['/usr/X11R6/bin/XF86_FBDev'])
    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()
todo = ToDo(intf, method, rootPath, runLive)

intf.run(todo)
todo.installSystem()

del intf

l = lilo.LiloConfiguration()
l.addEntry('boot', '/dev/hda')
l.addEntry('map', '/boot/map')
l.addEntry('install', '/boot/boot.b')
l.addEntry('prompt')
l.addEntry('timeout', 50)
s = lilo.LiloConfiguration()
s.addEntry('label', 'linux')
s.addEntry('root', '/dev/hda8')
s.addEntry('read-only')
l.addImage('/boot/vmlinuz', s)
#l.write('/etc/lilo.conf')