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
|
import isys
from installclass import InstallClass
import getopt
import sys
class Kickstart(InstallClass):
def doRootPw(self, args):
(args, extra) = getopt.getopt(args, '', [ 'iscrypted=' ])
isCrypted = 0
for n in args:
(str, arg) = n
if (str == '--iscrypted'):
isCrypted = 1
InstallClass.doRootPw(self, extra[0], isCrypted = isCrypted)
self.addToSkipList("accounts")
def doAuthconfig(self, args):
(args, extra) = getopt.getopt(args, '',
[ 'enablenis', 'nisdomain=', 'nisserver=', 'useshadow',
'enablemd5' ])
useNis = 0
useShadow = 0
useMd5 = 0
nisServer = None
nisDomain = None
nisBroadcast = 0
for n in args:
(str, arg) = n
if (str == '--enablenis'):
useNis = 1
elif (str == '--useshadow'):
useShadow = 1
elif (str == '--enablemd5'):
useMd5 = 1
elif (str == '--nisserver'):
nisServer = arg
elif (str == '--nisdomain'):
nisDomain = arg
if useNis and not nisServer: nisBroadcast = 1
self.setAuthentication(useShadow, useMd5, useNis, nisDomain,
nisBroadcast, nisServer)
self.addToSkipList("authentication")
def doLilo (self, args):
(args, extra) = getopt.getopt(args, '',
[ 'append=', 'location=', 'linear' ])
appendLine = None
location = "mbr"
linear = 0
for n in args:
(str, arg) = n
if str == '--append':
appendLine = arg
elif str == '--linear':
linear = 1
elif str == '--location':
if arg == 'mbr' or arg == 'partition':
location = arg
elif arg == 'none':
location = None
else:
raise ValueError, ("mbr, partition or none expected for "+
"lilo command")
self.setLiloInformation(location, linear, appendLine)
self.addToSkipList("lilo")
def doTimezone(self, args):
(args, extra) = getopt.getopt(args, '',
[ 'utc' ])
isUtc = 0
for n in args:
(str, arg) = n
if str == '--utc':
isUtc = 1
self.setTimezoneInfo(extra[0], asUtc = isUtc)
self.addToSkipList("timezone")
def doInstall(self, args):
self.installType = "install"
def doUpgrade(self, args):
self.installType = "upgrade"
def doNetwork(self, args):
(args, extra) = getopt.getopt(args, '',
[ 'bootproto', 'ip', 'netmask', 'gateway', 'nameserver' ])
bootProto = "dhcp"
ip = None
netmask = None
gateway = None
nameserve = None
for n in args:
(str, arg) = n
if str == "--bootproto":
bootProto = arg
elif str == "--ip":
ip = arg
elif str == "--netmask":
netmask = arg
elif str == "--gateway":
gateway = arg
elif str == "--nameserver":
nameserver = arg
self.setNetwork(bootProto, ip, netmask, gateway, nameserver)
def readKickstart(self, file):
handlers = {
"authconfig" : self.doAuthconfig ,
"cdrom" : None ,
"install" : self.doInstall ,
"network" : self.doNetwork ,
"lilo" : self.doLilo ,
"network" : None ,
"nfs" : None ,
"rootpw" : self.doRootPw ,
"timezone" : self.doTimezone ,
"upgrade" : self.doUpgrade ,
"xdisplay" : None ,
}
for n in open(file).readlines():
n = n[:len(n) - 1] # chop
args = isys.parseArgv(n)
if not args or args[0][0] == '#': continue
cmd = args[0]
if handlers[cmd]: handlers[cmd](args[1:])
def __init__(self, file):
InstallClass.__init__(self)
self.addToSkipList("bootdisk")
self.addToSkipList("welcome")
self.installType = "install"
self.readKickstart(file)
self.setGroups(["Base"])
self.addToSkipList("package-selection")
# need to take care of:
#[ "lilo", "mouse", "network", "complete",
#"package-selection", "bootdisk", "partition", "format",
#"dependencies", "language", "keyboard",
# "mouse" ].index(type)
|