summaryrefslogtreecommitdiffstats
path: root/rescue/list
diff options
context:
space:
mode:
Diffstat (limited to 'rescue/list')
0 files changed, 0 insertions, 0 deletions
id='n141' href='#n141'>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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
#!/usr/bin/perl -w

# Drakwizard PXE
# release 0.3
# Copyright (C) 2004 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 $INSTALLDIR = "/var/install/pxe";
#my $IA64PATH = '/IA64PC';

my $TMPDIR = '/tmp';
my $HOSTNAME = chomp_(`hostname`);
my $TFTPDIR = "/var/lib/tftpboot";
my $CLIENTPATH = '/X86PC/linux';
my $X86 = $TFTPDIR . $CLIENTPATH;
my $IMGPATH = $X86 . '/images';
my $PXEHELP = $X86 . '/help.txt';
my $PXEMESSAGE = $X86 . '/messages';
my $PXEDEFAULT = $X86 . '/pxelinux.cfg/default';

my $pxeconf = '/etc/pxe.conf';
my $SYSLINUXPATH = '/usr/lib/syslinux/';
my $MEMDISK = $SYSLINUXPATH . '/memdisk';
my $XINETDDIR = "/etc/xinetd.d";

my $IPSERVER = $wiz->{net}->itf_get("IPADDR");
if (!$IPSERVER) {
  my $interface = 'eth0';
  ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
}
#my $DOMAINNAME = $wiz->{net}->network_get("DOMAINNAME");
my $DOMAINNAME = chomp_(`dnsdomainname`);


my $o = {
	 name => N("PXE Wizard"),
	 allow_user => 'root',
	 var => {
		 IMG => '/var/install/9.2/images/network.img',
		 PXENAME => '92',
		 DESCR => 'install 9.2',
		 IMGTOREMOVE => '',
		 IMGTOMODIFY => '',
		 IP => '127.0.0.1',
		 DIR => '/var/install/',
		 ALLRDZ => '/mnt/cdrom/isolinux/alt0/all.rdz',
		 VMLINUZ => '/mnt/cdrom/isolinux/alt0/vmlinuz',
		 OPTION => '',
		 i => '',
		},
	 needed_rpm => [ 'pxe', 'tftp-server', 'xinetd' ],
	 init => sub {
	   if (member($DOMAINNAME, qw(localdomain (none)))) {
             return 0, N("You need to readjust your domainname, not equal to localdomain or none. Please launch drakconnect to adjust it.")
           }
           1
	 },
	};

my %level = (
             1 => N("Set PXE server"),
             2 => N("Add boot image in PXE"),
	     3 => N("Remove boot image in PXE"),
	     4 => N("Modify boot image in PXE"),
	     5 => N("Add all.rdz image in PXE"),
	    );


# to get list menu entry
my @list_menu;
foreach (cat_($PXEDEFAULT)) {
  my ($ent) = /# TAG: (\w+)_BEGIN/;
  ! $ent or push @list_menu,$ent;
}

#set default list for entry in syslinux.cfg
my @list_method = qw(nfs http);
my @list_ram = qw(32000 48000 64000 1280000);
my @list_vga = qw(788 normal 785 791 792 text);
my @list_acpi = qw(ht force off);
my @list_apic = qw(apic noapic);
my @list_eth = qw(eth0 eth1 eth2);

#begin of wizard
$o->{pages} = {
	       welcome => {
			   name => N("PXE wizard") . "\n\n" . N("Set a PXE server.") . "\n" . N("This wizard will help you configuring the PXE server, and PXE boot image management. PXE (Pre-boot eXecution Environment) is a protocol designed by Intel that allows computers to boot through the network. PXE is stored in the ROM of new generation network cards. When the computer boots up, the BIOS loads the PXE ROM in the memory and executes it. A menu is displayed, allowing the computer to boot an operating system loaded through the network."),
			   no_back => 1,
			   pre => sub {
			     $o->{var}{wiz_level} ||= 1;
			   },
			   post => sub {
			     if (! -f "$X86/drakwizard_pxe") { return 'pxeserver' }
			     if ($o->{var}{wiz_level} == 1) { return 'pxeserver' }
			     elsif ($o->{var}{wiz_level} == 2) { return 'addimg' }
			     elsif ($o->{var}{wiz_level} == 5) { return 'addimgrdz' }
			     @list_menu or return 'needimg';
			     if ($o->{var}{wiz_level} == 3) { return 'removeimg' }
			     elsif ($o->{var}{wiz_level} == 4) { return 'modifyimg' }
			   },
			   data => [
				    { label => N("What do you want to do:"), 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("To boot through network, the network computer needs a boot image. Morever we need to name this image, so each boot image is related to a name in PXE menu. User can then choose which image he wants to boot through PXE.") . "\n\n" . N("PXE description is used to explain the rule of the boot image, ie: Mandrake 10 image, Mandrake cooker image..") . "\n\n" . N("Path to image: provide the full path to the network boot image") . "\n\n" . N("PXE name: the name displayed in PXE menu (please provide a word or a  number, with no space)"),
			  data => [
				   { label => "PXE name:", val => \$o->{var}{PXENAME} },
				   { label => "PXE description:", val => \$o->{var}{DESCR} },
				   { label => "Full path to boot image:", val => \$o->{var}{IMG} },
				  ],
			  post => \&test_data,
			  next => 'summaryadd',
			 },
	       addimgrdz => {
			     name => N("Add all.rdz boot image") . "\n\n" . N("To boot through network, network computer need a boot image. Morever we need to name this image, so each boot image is related to a name in PXE menu. So user can choose wich image he wants to boot through PXE.") . "\n\n" . N("PXE description is used to explain the rule of the boot image, ie: Mandrake 10 image, Mandrake cooker image..") . N("For technical reason, in case of multiple boot image, it's more simple to boot network computer through a kernel (vmlinuz), and provide one file with all drivers needed (in our case all.rdz).") . "\n\n" . N("Path to all.rdz: provide the full path to all.rdz image") . "\n\n" . N("PXE name: the name displayed in PXE menu (please provide a word or a number, with no space)"),
			     data => [
				      { label => "PXE name:", val => \$o->{var}{PXENAME} },
				      { label => "PXE description:", val => \$o->{var}{DESCR} },
				      { label => "Full path to all.rdz image:", val => \$o->{var}{ALLRDZ} },
				      { label => "Full path to vmlinuz:", val => \$o->{var}{VMLINUZ} },
				     ],
			     post => \&test_datardz,
			     next => 'summaryaddrdz',
			    },
	       removeimg => {
			     name => N("Remove a boot image") . "\n\n" . N("Please choose the PXE boot image you want to remove from the PXE server.") . "\n\n" . N("The PXE boot image, and the related entry in PXE menu will be deleted."),
			     data => [
				      { label => N("Boot image to remove:"), val => \$o->{var}{IMGTOREMOVE}, fixed_list => \@list_menu },
				     ],
			     no_back => 1,
			     next => 'summaryremove',
			    },
	       modifyimg => {
			     name => N("Add options to boot image") . "\n\n" . N("In some cases, you want to add some options to the PXE boot image. This wizard provides an easy way to customize a boot image with common parameters.") . "\n\n" . N("Please choose, from the list below, the PXE boot image you want to modify"),
			     data => [
				      { label => N("Boot image to modify:"), val => \$o->{var}{IMGTOMODIFY}, fixed_list => \@list_menu },
				     ],
			     post => \&read_option,
			     no_back => 1,
			     next => 'gomodify',
			    },
	       gomodify => {
			    name => N("Add option to the PXE boot disk") . "\n\n" . N("Server IP: IP address of the server, which contains installation directory. You can create one with MDK install server wizard.") . "\n" . N("Install directory: the full path to MDK install server directory") . "\n" . N("Installation method: choose NFS or HTTP."),
			    data => [
				     { label => N("Boot image to modify:"), fixed_val => \$o->{var}{i} },
				     { label => N("Server IP:"), val => \$o->{var}{IP} },
				     { label => N("Install directory:"), val => \$o->{var}{DIR} },
				     { label => N("Installation method:"), val => \$o->{var}{METHOD}, fixed_list => \@list_method },
				    ],
			    next => 'gomodify2',
			    },
	       gomodify2 => {
			     name => N("Network client interface: the network interface used for the installation process.") . "\n" . N("Ramsize: adjust the ramsize parameter on boot disk.") . "\n" . N("VGA option: if you encounter any problem whith VGA, please adjust. ") . "\n" . N("ACPI option: Advanced Configuration and Power Interface"),
			     data => [
				      { label => N("Network client interface:"), val => \$o->{var}{ETH}, fixed_list => \@list_eth },
				      { label => N("Ramsize:"), val => \$o->{var}{RAM}, fixed_list => \@list_ram },
				      { label => N("VGA option:"), val => \$o->{var}{VGA}, fixed_list => \@list_vga },
				      { label => N("ACPI option:"), val => \$o->{var}{ACPI}, fixed_list => \@list_acpi },
				      { label => N("APIC option:"), val => \$o->{var}{APIC}, fixed_list => \@list_apic },
				      { label => N("Custom option:"), val => \$o->{var}{OPTION} },
				     ],
			     next => 'summarymodify',
			   },
	       pxeserver => {
			     name => N("Set PXE server") . "\n\n" . N("We need to use a special dhcpd.conf file with PXE parameter. To set up such a DHCP server, launch the DHCP wizard and check the box 'Enable PXE'. If you don't do that, PXE query will not be answered by this server.") . "\n" . N("Now the wizard will configure all needed default configuration files to allow computers to boot through the network."),
			     next => 'summaryserver',
			    },
	       error_img => {
			     name => N("Please provide a bootable image. To boot through a network, network computers need a boot image."),
			     next => 'addimg',
			    },
	       needimg => {
			   name => N("We need an all.rdz or a network.img image. Please add one."),
			   no_back => 1,
			   next => 'welcome',
			   post => sub {
			     $o->{var}{wiz_level} = 5
			   },
			  },
	       error_imgrdz => {
			     name => N("Please provide an all.rdz image, wich contains all drivers. You can find one on the first CD of Mandrakelinux distribution, in /isolinux/alt0/ directory."),
			     next => 'addimgrdz',
			    },
	       error_path_img => {
				  name => N("Please choose an image from a different directory than %s.", $IMGPATH),
				  next => 'addimg',
				 },
	       error_path_imgrdz => {
				  name => N("Please choose an image from a different directory than %s.", $IMGPATH),
				  next => 'addimgrdz',
				 },
	       error_name => {
			      name => N("Please provide a correct PXE name: one word or one number with no space."),
			      next => 'addimg',
			     },
	       error_needpxe => {
				  name => N("To add/remove/modify PXE boot image, you need to run 'Set PXE server' before."),
				 no_back => 1,
				  next => 'pxeserver',
				 },
	       simmilar_entry => {
				  name => N("A similar name is already used in PXE menu") . "\n\n" . N("Please provide another one."),
				  next => 'addimg',
				 },
	       simmilar_entryrdz => {
				  name => N("A similar name is already used in PXE menu") . "\n\n" . N("Please provide another one."),
				  next => 'addimgrdz',
				 },
	       summaryserver => {
				 name => N("The wizard will now prepare all default files to set your PXE server"),
				 data => [
					  { label => N("TFTP directory:"), fixed_val => \$TFTPDIR },
					  { label => N("Boot image path:"), fixed_val => \$IMGPATH },
					  { label => N("PXE 'default' file:"), fixed_val => \$PXEDEFAULT },
					  { label => N("PXE 'help' file:"), fixed_val => \$PXEHELP },
					 ],
				 post => \&do_it_pxe,
				 next => 'endserver',
				},
	       summarymodify => {
				 name => N("The wizard will now modify boot options with those parameters:"),
				 data => [
					  { label => N("Boot image to modify:"), fixed_val => \$o->{var}{i} },
					  { label => N("Server IP:"), fixed_val => \$o->{var}{IP} },
					  { label => N("Install directory:"), fixed_val => \$o->{var}{DIR} },
					  { label => N("Installation method:"), fixed_val => \$o->{var}{METHOD} },
					  { label => N("Network client interface:"), fixed_val => \$o->{var}{ETH} },
					  { label => N("Ramsize:"), fixed_val => \$o->{var}{RAM} },
					  { label => N("VGA option:"), fixed_val => \$o->{var}{VGA} },
					  { label => N("ACPI option:"), fixed_val => \$o->{var}{ACPI} },
					  { label => N("APIC option:"), fixed_val => \$o->{var}{APIC} },
					  { label => N("Custom option:"), fixed_val => \$o->{var}{OPTION} },
					 ],
				 post => \&do_it_modify,
				 next => 'endmodify',
				},
	       summaryremove => {
				 name => N("The wizard will now remove this PXE boot image"),
				 data => [
					  { label => N("PXE entry to remove:"), fixed_val => \$o->{var}{IMGTOREMOVE} },
					 ],
				 no_back => 1,
				 post => \&do_it_remove,
				 next => 'endremove',
				},
	       summaryadd => {
			      name => N("The wizard will now add this PXE boot image"),
				 data => [
					  { label => "PXE name:", fixed_val => \$o->{var}{PXENAME} },
					  { label => "PXE description:", fixed_val => \$o->{var}{DESCR} },
					  { label => "Path to boot image:", fixed_val => \$o->{var}{IMG} },
					 ],
			      post => \&do_it_add,
			      next => 'endadd',
			     },
	       summaryaddrdz => {