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
|
#!/usr/bin/perl -w
# Drakwizard
# Copyright (C) 2003 Mandrakesoft
#
# Author: Antoine Ginies <aginies _ateuh _ mandrakesoft.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package MDK::Wizard::Pxe;
use lib qw(/usr/lib/libDrakX);
use strict;
use common;
use services;
use MDK::Wizard::Wizcommon;
my $wiz = new MDK::Wizard::Wizcommon;
my $TMPDIR = '/tmp';
my $CLIENTPATH = 'PXEClient';
my $IA64PATH = 'IA64PC';
my $TFTPDIR = "/var/lib/tftpboot";
my $INSTALLDIR = "/var/install/pxe";
my $CONF = '/etc/pxe.conf';
my $SYSLINUXPATH = '/usr/lib/syslinux/';
my $PXEDEFAULT = 'pxelinux.cfg/default';
my $PXEMENU = "$TMPDIR/default.pxe";
my $PXEMESSAGE = "$TMPDIR/message.pxe";
my $PXEMENU = "$TMPDIR/default.pxe";
my $PXEMESSAGE = "$TMPDIR/message.pxe";
my $PXEHELP = "$TMPDIR/help.txt.pxe";
my $o = {
name => N("PXE Wizard"),
var => {
},
needed_rpm => [ 'pxe', 'tftp-server' ],
};
my %level = (
1 => N("PXE - Set PXE server"),
2 => N("add - Add image in PXE"),
3 => N("remove - remove image in PXE"),
4 => N("Modify - Modify image in PXE"),
);
$o->{pages} = {
welcome => {
name => N("PXE wizard") . "\n\n" . N("Set a PXE server.") . "\n\n" . N("This wizard will help you configuring the PXE server. This configuration will provide a pxe services, and ability to add/remove/modify boot images."),
no_back => 1,
pre => sub {
$o->{var}{wiz_level} ||= 1;
},
post => sub {
if ($o->{var}{wiz_level} == 2) {
return 'addimg' }
elsif ($o->{var}{wiz_level} == 3) {
return 'removeimg' }
elsif ($o->{var}{wiz_level} == 4) {
return 'modifyimg' }
},
data => [
{ label => N("Wich operation:"), val => \$o->{var}{wiz_level}, list => [ keys %level ], format => sub { $level{$_[0]} } },
],
no_back => 1,
next => 'pxeserver',
},
addimg => {
name => N("Add a boot Image") . "\n\n" . N("Where is that boot image ?"),
data => [
{ label => "", val => \$o->{var}{dummy} },
],
next => 'summaryadd',
},
removeimg => {
name => N("Remove a boot Image") . "\n\n" . N("Which one ?"),
data => [
{ label => "", val => \$o->{var}{dummy} },
],
next => 'summaryremove',
},
modifyimg => {
name => N("Add Option to boot image") . "\n\n" . N("on Wich image ?"),
data => [
{ label => "", val => \$o->{var}{dummy} },
],
next => 'summarymodify',
},
pxeserver => {
name => N("Set PXE server") . "\n\n" . N("We will use a special dhcpd.conf"),
data => [
{ label => "", val => \$o->{var}{dummy} },
],
next => 'summaryserver',
},
error_dir => {
name => N('Error Should be a directory'),
next => '',
},
summaryserver => {
name => N(''),
next => 'endserver',
},
summarymodify => {
name => N(''),
next => 'endmodify',
},
summaryremove => {
name => N(''),
next => 'endremove',
},
summaryadd => {
name => N(''),
next => 'endadd',
},
endadd => {
name => N('Congratulations'),
data => [ { label => N('The wizard successfully add a PXE image.') } ],
no_back => 1,
end => 1,
next => 0
},
endremove => {
name => N('Congratulations'),
data => [ { label => N('The wizard successfully remove a PXE image.') } ],
no_back => 1,
end => 1,
next => 0
},
endmodify => {
name => N('Congratulations'),
data => [ { label => N('The wizard successfully modify image(s).') } ],
no_back => 1,
end => 1,
next => 0
},
endserver => {
name => N('Congratulations'),
data => [ { label => N('The wizard successfully configured Your PXE server.') } ],
no_back => 1,
end => 1,
next => 0
},
};
sub syslinux_prep {
# cp_af( "/memdisk", $FULLINTEL);
}
sub crea_wdir {
if (-e $TMPDIR) { rm_rf($TMPDIR);
}
mkdir_p($TMPDIR);
}
sub new {
my ($class, $conf) = @_;
bless {
o => $o,
}, $class;
}
1;
|