From 6274f6dc84f2dbd399554308f3f31b31f49126f5 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Tue, 16 Dec 2003 14:34:35 +0000 Subject: struct of futur PXE wizard --- pxe_wizard/Pxe.pm | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 pxe_wizard/Pxe.pm (limited to 'pxe_wizard/Pxe.pm') diff --git a/pxe_wizard/Pxe.pm b/pxe_wizard/Pxe.pm new file mode 100644 index 00000000..e2ac5506 --- /dev/null +++ b/pxe_wizard/Pxe.pm @@ -0,0 +1,150 @@ +#!/usr/bin/perl -w + +# Drakwizard + +# Copyright (C) 2003 Mandrakesoft +# +# Author: Florent Villard +# +# 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 $intel_path = 'PXEClient'; +my $com_path = 'X86PC'; +my $ia64_path = 'IA64PC'; +my $TFTPDIR = "/var/lib/tftpboot"; +my $full64 = $TFTPDIR . '/' . $ia64_path . '/linux'; +my $img_path64 = "$full64/images"; +my $temp_dir = '/tmp'; +my $INSTALLDIR = "/var/install/pxe"; + +my $o = { + name => N("PXE Wizard"), + var => { + INTELPATH => $intel_path, + COMPATH => $com_path, + IA64PATH => $ia64_path, + FULLINTEL => $TFTPDIR . '/' . $intel_path, + FULLCOM => $TFTPDIR . '/' . $com_path . '/linux', + FULL64 => $full64, + IMGPATH64 => $img_path64, + NET64 => "$img_path64/net", + KA64 => "$img_path64/ka", + TEMPDIR => $temp_dir, + PXEDEFAULT => 'pxelinux.cfg/default', + PXEDEFAULT64 => 'linux.1', + PXEMENU => "$temp_dir/default.pxe", + PXEMESSAGE => "$temp_dir/message.pxe", + FREEDOSIMAGE => $INSTALLDIR . '/images/freedos.img', + KAIMAGE => $INSTALLDIR . '/images/ka.img', + NETIMAGE => "$temp_dir/network.img", + SYSLINUXPATH => '/usr/lib/syslinux/', + PXEHELP => "$temp_dir/help.txt.pxe", + ELILO => '/boot/efi/elilo.efi', + CONF => '/etc/pxe.conf', + }, + 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 => { + }, + removeimg => { + }, + modifyimg => { + }, + pxeserver => { + }, + endserver => { + name => N('Congratulations'), + data => [ { label => N('The wizard successfully configured Your PXE server.') } ], + no_back => 1, + end => 1, + next => 0 + }, + error_dir => { + name => N('Error Should be a directory'), + next => '', + }, + 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 + }, + }; + + +sub new { + my ($class, $conf) = @_; + bless { + o => $o, + }, $class; +} + +1; -- cgit v1.2.1