line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SysConfig::Kickstart; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.2'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
##################################################################### |
6
|
|
|
|
|
|
|
# Kickstart.pm |
7
|
|
|
|
|
|
|
# by Patrick Devine |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# This software is covered under the same terms as Perl itself. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# WARNING: |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# This software is no where near finished and lots of stuff will |
14
|
|
|
|
|
|
|
# probably change before it is officially released (as 1.0). |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
567
|
use SysConfig; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1750
|
|
19
|
|
|
|
|
|
|
@ISA = qw/ SysConfig /; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
##################################################################### |
23
|
|
|
|
|
|
|
# method: kickstart |
24
|
|
|
|
|
|
|
# function: creates a scalar containing all of the data necessary |
25
|
|
|
|
|
|
|
# for to create a kickstart file |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub kickstart { |
28
|
1
|
|
|
1
|
0
|
34
|
my $self = shift; |
29
|
1
|
|
|
|
|
2
|
my $version = shift; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
2
|
my $buf; |
32
|
1
|
|
|
|
|
2
|
my $settings = $self->{settings}; |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
2
|
$buf .= "# This file was autogenerated by SysConfig::Kickstart.pm\n"; |
35
|
1
|
|
|
|
|
2
|
$buf .= "# Use at your own risk.\n"; |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
2
|
$buf .= "\n# Installation Method\n"; |
38
|
1
|
50
|
|
|
|
4
|
if( $settings->{inst_type}->{inst_type} eq 'nfs' ) { |
|
|
0
|
|
|
|
|
|
39
|
1
|
|
|
|
|
2
|
my( $host, $dir ); |
40
|
1
|
50
|
|
|
|
8
|
( $host, $dir ) = split ':', $settings->{inst_type}->{nfsserver} |
41
|
|
|
|
|
|
|
if $settings->{inst_type}->{nfsserver}; |
42
|
1
|
|
|
|
|
5
|
$buf .= "nfs --server $host --dir $dir\n"; |
43
|
|
|
|
|
|
|
} elsif( $settings->{inst_type}->{inst_type} eq 'cdrom' ) { |
44
|
0
|
|
|
|
|
0
|
$buf .= "cdrom\n"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
1
|
50
|
|
|
|
3
|
if( exists $settings->{rootpw} ) { |
48
|
0
|
|
|
|
|
0
|
$buf .= "\n# root password\nrootpw "; |
49
|
0
|
0
|
|
|
|
0
|
$buf .= '--iscrypted ' |
50
|
|
|
|
|
|
|
if $settings->{rootpw}->{iscrypted}; |
51
|
0
|
|
|
|
|
0
|
$buf .= "$settings->{rootpw}->{rootpw}\n"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
1
|
50
|
33
|
|
|
12
|
if( exists $settings->{auth}->{useshadow} or |
|
|
|
33
|
|
|
|
|
56
|
|
|
|
|
|
|
exists $settings->{auth}->{enablemd5} or |
57
|
|
|
|
|
|
|
exists $settings->{auth}->{enablenis} ) { |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
0
|
$buf .= "\n# Autconfig\nauth "; |
60
|
0
|
0
|
|
|
|
0
|
if( exists $settings->{auth}->{enablenis} ) { |
61
|
0
|
|
|
|
|
0
|
$buf .= "--enablenis --nisdomain $settings->{auth}->{nisdomain} "; |
62
|
0
|
|
|
|
|
0
|
$buf .= "--nisserver $settings->{auth}->{nisserver} "; |
63
|
|
|
|
|
|
|
} |
64
|
0
|
0
|
|
|
|
0
|
$buf .= '--useshadow ' if exists $settings->{auth}->{useshadow}; |
65
|
0
|
0
|
|
|
|
0
|
$buf .= '--enablemd5 ' if exists $settings->{auth}->{enablemd5}; |
66
|
0
|
0
|
0
|
|
|
0
|
if( exists $settings->{auth}->{enableldap} and $version >= 700 ) { |
67
|
0
|
|
|
|
|
0
|
$buf .= '--enableldap '; |
68
|
0
|
0
|
|
|
|
0
|
$buf .= '--enableldapauth ' |
69
|
|
|
|
|
|
|
if $settings->{auth}->{enableldapauth}; |
70
|
0
|
0
|
|
|
|
0
|
$buf .= "--ldapserver=$settings->{auth}->{ldapserver} " |
71
|
|
|
|
|
|
|
if $settings->{auth}->{ldapserver}; |
72
|
0
|
0
|
|
|
|
0
|
$buf .= "--ldapbasedn=$settings->{auth}->{ldapbasedn} " |
73
|
|
|
|
|
|
|
if $settings->{auth}->{ldapbasedn}; |
74
|
|
|
|
|
|
|
} |
75
|
0
|
0
|
0
|
|
|
0
|
if( $settings->{auth}->{enablekrb5} and $version >= 700 ) { |
76
|
0
|
|
|
|
|
0
|
$buf .= '--enablekrb5 '; |
77
|
0
|
0
|
|
|
|
0
|
$buf .= "--krb5realm $settings->{auth}->{krb5realm} " |
78
|
|
|
|
|
|
|
if $settings->{auth}->{krb5realm}; |
79
|
0
|
|
|
|
|
0
|
$buf .= '--krb5kdc '; |
80
|
0
|
|
|
|
|
0
|
$buf .= join ',', map { $settings->{auth}->{"krb5kdc$_"} } 0 .. 3; |
|
0
|
|
|
|
|
0
|
|
81
|
0
|
|
|
|
|
0
|
$buf .= ' '; |
82
|
0
|
0
|
|
|
|
0
|
$buf .= "--krb5adminserver $settings->{auth}->{krb5kdc0} " |
83
|
|
|
|
|
|
|
if $settings->{auth}->{krb5kdc0}; |
84
|
|
|
|
|
|
|
} |
85
|
0
|
0
|
0
|
|
|
0
|
if( $settings->{auth}->{enablehesiod} and $version >= 700 ) { |
86
|
0
|
|
|
|
|
0
|
$buf .= '--enablehesiod '; |
87
|
0
|
0
|
|
|
|
0
|
$buf .= "--hesiodlhs $settings->{auth}->{hesiodlhs} " |
88
|
|
|
|
|
|
|
if $settings->{auth}->{hesiodlhs}; |
89
|
0
|
0
|
|
|
|
0
|
$buf .= "--hesiodrhs $settings->{auth}->{hesiodrhs} " |
90
|
|
|
|
|
|
|
if $settings->{auth}->{hesiodrhs}; |
91
|
|
|
|
|
|
|
} |
92
|
0
|
|
|
|
|
0
|
$buf .= "\n"; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
1
|
50
|
|
|
|
3
|
if( exists $self->{settings}->{device} ) { |
97
|
0
|
|
|
|
|
0
|
$buf .= "\n# Extra Devices\n"; |
98
|
0
|
|
|
|
|
0
|
for( @{ $self->{settings}->{device} } ) { |
|
0
|
|
|
|
|
0
|
|
99
|
0
|
0
|
0
|
|
|
0
|
next unless $_->{type} eq 'scsi' or $_->{type} eq 'eth'; |
100
|
0
|
|
|
|
|
0
|
$buf .= "device $_->{type} $_->{module} "; |
101
|
0
|
0
|
|
|
|
0
|
$buf .= "--opts \"$_->{opts}\"" |
102
|
|
|
|
|
|
|
if exists $_->{opts}; |
103
|
0
|
|
|
|
|
0
|
$buf .= "\n"; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
1
|
50
|
33
|
|
|
6
|
if( exists $settings->{driverdisk} and $version >= 623 ) { |
108
|
0
|
|
|
|
|
0
|
$buf .= "\n# Driver Disk\n driverdisk "; |
109
|
0
|
|
|
|
|
0
|
$buf .= $settings->{driverdisk}->{partition}; |
110
|
0
|
|
|
|
|
0
|
$buf .= " --type $settings->{driverdisk}->{fs}\n"; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
1
|
50
|
|
|
|
4
|
if( exists $settings->{lilo} ) { |
114
|
0
|
|
|
|
|
0
|
$buf .= "\n# LILO\nlilo "; |
115
|
0
|
0
|
|
|
|
0
|
$buf .= "--append \"$settings->{lilo}->{append}\" " |
116
|
|
|
|
|
|
|
if exists $settings->{lilo}->{append}; |
117
|
0
|
0
|
|
|
|
0
|
$buf .= "--location $settings->{lilo}->{location}\n" |
118
|
|
|
|
|
|
|
if $settings->{lilo}->{location}; |
119
|
0
|
|
|
|
|
0
|
$buf .= "\n"; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
1
|
50
|
33
|
|
|
4
|
$buf .= "\n# LILO Check\nlilocheck\n" |
123
|
|
|
|
|
|
|
if exists $settings->{lilocheck} and $version >= 623; |
124
|
|
|
|
|
|
|
|
125
|
1
|
50
|
|
|
|
3
|
if( exists $settings->{timezone}->{timezone} ) { |
126
|
0
|
|
|
|
|
0
|
$buf .= "\n# Timezone\ntimezone "; |
127
|
0
|
0
|
|
|
|
0
|
$buf .= "--utc " |
128
|
|
|
|
|
|
|
if exists $settings->{timezone}->{utc}; |
129
|
0
|
|
|
|
|
0
|
$buf .= "$settings->{timezone}->{timezone}\n"; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
1
|
|
|
|
|
2
|
$buf .= "\n# X Windowing System\n"; |
133
|
|
|
|
|
|
|
|
134
|
1
|
50
|
|
|
|
3
|
if( exists $settings->{xconfig} ) { |
135
|
0
|
|
|
|
|
0
|
$buf .= "xconfig "; |
136
|
0
|
0
|
0
|
|
|
0
|
$buf .= "--noprobe \"$settings->{xconfig}->{noprobe}\" " |
137
|
|
|
|
|
|
|
if exists $settings->{xconfig}->{noprobe} and $version >= 623; |
138
|
0
|
0
|
|
|
|
0
|
$buf .= "--server \"$settings->{xconfig}->{server}\" " |
139
|
|
|
|
|
|
|
if exists $settings->{xconfig}->{server}; |
140
|
0
|
0
|
|
|
|
0
|
$buf .= "--card \"$settings->{xconfig}->{card}\" " |
141
|
|
|
|
|
|
|
if exists $settings->{xconfig}->{card}; |
142
|
0
|
0
|
|
|
|
0
|
$buf .= "--monitor \"$settings->{xconfig}->{monitor}\" " |
143
|
|
|
|
|
|
|
if exists $settings->{xconfig}->{monitor}; |
144
|
0
|
0
|
|
|
|
0
|
$buf .= "--hsync \"$settings->{xconfig}->{hsync}\" " |
145
|
|
|
|
|
|
|
if exists $settings->{xconfig}->{hsync}; |
146
|
0
|
0
|
|
|
|
0
|
$buf .= "--vsync \"$settings->{xconfig}->{vsync}\" " |
147
|
|
|
|
|
|
|
if exists $settings->{xconfig}->{vsync}; |
148
|
0
|
0
|
0
|
|
|
0
|
$buf .= "--startxonboot \"$settings->{xconfig}->{startxonboot}\" " |
149
|
|
|
|
|
|
|
if exists $settings->{xconfig}->{startxonboot} and $version >= 623; |
150
|
0
|
|
|
|
|
0
|
$buf .= "\n"; |
151
|
|
|
|
|
|
|
} else { |
152
|
1
|
|
|
|
|
2
|
$buf .= "skipx\n"; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
1
|
50
|
33
|
|
|
4
|
$buf .= "\n# Skip X\nskipx\n" |
156
|
|
|
|
|
|
|
if exists $settings->{skipx}->{skipx} and $version >= 623; |
157
|
|
|
|
|
|
|
|
158
|
1
|
|
|
|
|
3
|
$buf .= "\n# Install or Upgrade"; |
159
|
1
|
50
|
33
|
|
|
5
|
$buf .= "\ninstall\n" |
160
|
|
|
|
|
|
|
unless exists $settings->{install}->{install} and |
161
|
|
|
|
|
|
|
$settings->{install}->{install} eq 'upgrade'; |
162
|
|
|
|
|
|
|
|
163
|
1
|
50
|
|
|
|
5
|
if( exists $settings->{network} ) { |
164
|
|
|
|
|
|
|
|
165
|
0
|
0
|
|
|
|
0
|
$settings->{network}->{bootproto} = $settings->{network}->{network} |
166
|
|
|
|
|
|
|
if $settings->{network}->{network}; |
167
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
0
|
$buf .= "\n# Network install type\nnetwork --bootproto "; |
169
|
0
|
0
|
|
|
|
0
|
if( $settings->{network}->{bootproto} ne 'static' ) { |
170
|
0
|
|
|
|
|
0
|
$buf .= "$settings->{network}->{bootproto}\n"; |
171
|
|
|
|
|
|
|
} else { |
172
|
0
|
|
|
|
|
0
|
$buf .= "static "; |
173
|
0
|
0
|
|
|
|
0
|
$buf .= "--ip $settings->{network}->{ip} " |
174
|
|
|
|
|
|
|
if exists $settings->{network}->{ip}; |
175
|
0
|
0
|
|
|
|
0
|
$buf .= "--netmask $settings->{network}->{netmask} " |
176
|
|
|
|
|
|
|
if exists $settings->{network}->{netmask}; |
177
|
0
|
0
|
|
|
|
0
|
$buf .= "--gateway $settings->{network}->{gateway} " |
178
|
|
|
|
|
|
|
if exists $settings->{network}->{gateway}; |
179
|
0
|
0
|
|
|
|
0
|
$buf .= "--nameserver $settings->{network}->{nameserver} " |
180
|
|
|
|
|
|
|
if exists $settings->{network}->{nameserver}; |
181
|
0
|
0
|
|
|
|
0
|
$buf .= "--hostname $settings->{network}->{hostname} " |
182
|
|
|
|
|
|
|
if exists $settings->{network}->{hostname}; |
183
|
0
|
|
|
|
|
0
|
$buf .= "\n"; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
1
|
50
|
|
|
|
4
|
$buf .= "\n# Language\nlang $settings->{lang}->{lang}\n" |
188
|
|
|
|
|
|
|
if exists $settings->{lang}->{lang}; |
189
|
|
|
|
|
|
|
|
190
|
1
|
50
|
|
|
|
4
|
$buf .= "\n# Keyboard\nkeyboard $settings->{keyboard}->{keyboard}\n" |
191
|
|
|
|
|
|
|
if exists $settings->{keyboard}->{keyboard}; |
192
|
|
|
|
|
|
|
|
193
|
1
|
50
|
|
|
|
4
|
$buf .= "\n# Zero mbr\nzerombr yes\n" |
194
|
|
|
|
|
|
|
if exists $settings->{zerombr}->{zerombr}; |
195
|
|
|
|
|
|
|
|
196
|
1
|
50
|
|
|
|
3
|
if( $settings->{mouse} ) { |
197
|
0
|
|
|
|
|
0
|
$buf .= "\n# Mouse\nmouse "; |
198
|
0
|
0
|
|
|
|
0
|
if( $version >= 623 ) { |
199
|
0
|
0
|
|
|
|
0
|
$buf .= "--device $settings->{mouse}->{device} " |
200
|
|
|
|
|
|
|
if exists $settings->{mouse}->{device}; |
201
|
0
|
0
|
|
|
|
0
|
$buf .= "--emulthree " |
202
|
|
|
|
|
|
|
if exists $settings->{mouse}->{emulthree}; |
203
|
|
|
|
|
|
|
} else { |
204
|
0
|
|
|
|
|
0
|
$buf .= "--kickstart "; |
205
|
|
|
|
|
|
|
} |
206
|
0
|
|
|
|
|
0
|
$buf .= "$settings->{mouse}->{mouse}\n"; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
1
|
50
|
33
|
|
|
41
|
$buf .= "\n# Reboot after install\nreboot\n" |
210
|
|
|
|
|
|
|
if exists $settings->{reboot}->{reboot} and $version > 623; |
211
|
|
|
|
|
|
|
|
212
|
1
|
50
|
|
|
|
5
|
if( $settings->{install} ne 'upgrade' ) { |
213
|
|
|
|
|
|
|
|
214
|
1
|
50
|
|
|
|
4
|
$buf .= "\n# Clear Partitions\nclearpart " . |
215
|
|
|
|
|
|
|
"--$settings->{clearpart}->{clearpart}\n" |
216
|
|
|
|
|
|
|
if $settings->{clearpart}->{clearpart}; |
217
|
|
|
|
|
|
|
|
218
|
1
|
|
|
|
|
2
|
$buf .= "\n# Partitioning\n"; |
219
|
1
|
|
|
|
|
1
|
for( @{ $self->{settings}->{partition} } ) { |
|
1
|
|
|
|
|
5
|
|
220
|
0
|
0
|
|
|
|
0
|
next unless $_->{size}; |
221
|
|
|
|
|
|
|
|
222
|
0
|
0
|
|
|
|
0
|
$_->{dir} = 'swap' |
223
|
|
|
|
|
|
|
if $_->{type} eq 'swap'; |
224
|
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
0
|
$buf .= "part $_->{dir} --size $_->{size} "; |
226
|
0
|
0
|
|
|
|
0
|
$buf .= "--grow " |
227
|
|
|
|
|
|
|
if exists $_->{grow}; |
228
|
0
|
0
|
0
|
|
|
0
|
$buf .= "--ondisk $_->{ondisk}" |
229
|
|
|
|
|
|
|
if exists $_->{ondisk} and $_->{ondisk} ne 'logical'; |
230
|
0
|
|
|
|
|
0
|
$buf .= "\n"; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
1
|
50
|
|
|
|
4
|
if( exists $self->{settings}->{raid} ) { |
234
|
0
|
|
|
|
|
0
|
$buf .= "\n# Software RAID\n"; |
235
|
0
|
|
|
|
|
0
|
for( @{ $self->{settings}->{raid} } ) { |
|
0
|
|
|
|
|
0
|
|
236
|
0
|
|
|
|
|
0
|
$buf .= "raid $_->{dir} "; |
237
|
0
|
0
|
|
|
|
0
|
$buf .= "--level $_->{level} " |
238
|
|
|
|
|
|
|
if exists $_->{level}; |
239
|
0
|
0
|
|
|
|
0
|
$buf .= "--device $_->{device} " |
240
|
|
|
|
|
|
|
if exists $_->{device}; |
241
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
0
|
$buf .= join ' ', @{ $_->{partitions} }; |
|
0
|
|
|
|
|
0
|
|
243
|
0
|
|
|
|
|
0
|
$buf .= "\n"; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
1
|
|
|
|
|
7
|
$buf .= "\n# Packages\n%packages\n"; |
248
|
|
|
|
|
|
|
|
249
|
1
|
|
|
|
|
2
|
for( keys %{ $self->{settings}->{package} } ) { |
|
1
|
|
|
|
|
25
|
|
250
|
0
|
0
|
|
|
|
0
|
$buf .= "$_\n" |
251
|
|
|
|
|
|
|
if $self->{settings}->{package}->{$_} eq 'on'; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
1
|
|
|
|
|
3
|
$buf .= "\n# Post install\n%post\n"; |
255
|
|
|
|
|
|
|
|
256
|
1
|
|
|
|
|
1
|
for( keys %{ $self->{settings}->{service} } ) { |
|
1
|
|
|
|
|
3
|
|
257
|
0
|
0
|
|
|
|
0
|
$buf .= ( $self->{settings}->{service}->{$_} eq 'on' ? |
258
|
|
|
|
|
|
|
"/sbin/chkconfig --add $_\n" : |
259
|
|
|
|
|
|
|
"/sbin/chkconfig --del $_\n" ); |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
1
|
50
|
|
|
|
4
|
if( exists $self->{settings}->{pre} ) { |
264
|
0
|
|
|
|
|
0
|
$buf .= "\n\%pre\n"; |
265
|
0
|
0
|
|
|
|
0
|
if( ref( $self->{settings}->{pre} ) eq 'ARRAY' ) { |
266
|
0
|
|
|
|
|
0
|
$buf .= join "\n", @{ $self->{settings}->{pre}->{pre} }; |
|
0
|
|
|
|
|
0
|
|
267
|
|
|
|
|
|
|
} else { |
268
|
0
|
|
|
|
|
0
|
$buf .= $self->{settings}->{pre}->{pre}; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
1
|
50
|
|
|
|
3
|
if( exists $self->{settings}->{post} ) { |
273
|
0
|
|
|
|
|
0
|
$buf .= "\n\%post\n"; |
274
|
0
|
0
|
|
|
|
0
|
if( ref( $self->{settings}->{post} ) eq 'ARRAY' ) { |
275
|
0
|
|
|
|
|
0
|
$buf .= join "\n", @{ $self->{settings}->{post}->{post} }; |
|
0
|
|
|
|
|
0
|
|
276
|
|
|
|
|
|
|
} else { |
277
|
0
|
|
|
|
|
0
|
$buf .= $self->{settings}->{post}->{post}; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
1
|
|
|
|
|
5
|
return \$buf; |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
1; |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
__END__ |