summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2004-11-12 14:10:57 +0000
committerAntoine Ginies <aginies@mandriva.com>2004-11-12 14:10:57 +0000
commit061b119a0f819909f7943c0f04b105ad44626be9 (patch)
treee46511b2c33abce1d8debd15b779bd115570ee32 /drakpxelinux.pl
parent5b8704a8536f2902cf998eb97b31f757de43a2d2 (diff)
downloaddrakpxelinux-061b119a0f819909f7943c0f04b105ad44626be9.tar
drakpxelinux-061b119a0f819909f7943c0f04b105ad44626be9.tar.gz
drakpxelinux-061b119a0f819909f7943c0f04b105ad44626be9.tar.bz2
drakpxelinux-061b119a0f819909f7943c0f04b105ad44626be9.tar.xz
drakpxelinux-061b119a0f819909f7943c0f04b105ad44626be9.zip
support multiple interface; add test in add_wizard
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r--drakpxelinux.pl75
1 files changed, 61 insertions, 14 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index 86c0b6d..beefba8 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -59,8 +59,19 @@ my $SYSLINUXPATH = '/usr/lib/syslinux/';
my $MEMDISK = $SYSLINUXPATH . '/memdisk';
my $XINETDDIR = "/etc/xinetd.d";
-my $interface = 'eth0';
-my ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
+#my $interface = 'eth0';
+#my ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
+#my $IPSERVER = $wiz->{net}->itf_get("IPADDR");
+my $IPSERVER;
+my $sys_wizard_pxe = "/etc/sysconfig/drak_pxe";
+if (-f $sys_wizard_pxe) {
+ our ($interface) = cat_($sys_wizard_pxe) =~ /INTERFACE=(.*)/;
+ ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
+} else {
+ our $interface = "eth0";
+ ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
+}
+
my $DOMAINNAME = chomp_(`dnsdomainname`);
my $help = "" .
@@ -95,6 +106,7 @@ my %help = (
'wizardsrv' => N("launches a wizard to setup a PXE server"),
'editb' => N("edits the PXE entry selected with a dialog box"),
'removepxe' => N("removes the selected PXE entry"),
+ 'pxeserver' => N("Launch PXE server Wizard"),
'addpxe' => N("launches a wizard to add a PXE entry "),
'helponline' => N("get help from online documentation"),
);
@@ -131,6 +143,7 @@ my %list_vga_res = (
'788' => "800x600",
'791' => "1024x768",
'794' => "1280x1024",
+ '' => "automatic",
);
my @list_eth = qw(eth0 eth1 eth2); push @list_eth, "";
@@ -327,11 +340,11 @@ sub wizard_add_entry {
undef $::WizardWindow;
$::isWizard = 1;
use wizards;
- my $WPXENAME = "Mandrakeclustering";
- my $WINFO = "install Mandrakeclustering";
- my $WALLRDZ = "/home/nis/install/clic/isolinux/alt0/all.rdz";
+ my $WPXENAME = "Mandrakelinux";
+ my $WINFO = "install Mandrakelinux";
+ my $WALLRDZ = "/mnt/10.1/isolinux/alt0/all.rdz";
# my $WALLRDZ = "/tmp/all.rdz";
- my $WVMLINUZ = "/home/nis/install/clic/isolinux/alt0/vmlinuz";
+ my $WVMLINUZ = "/mnt/10.1/isolinux/alt0/vmlinuz";
# my $WVMLINUZ = "/tmp/vmlinuz";
my $w = wizards->new;
my $wiz = {
@@ -349,7 +362,7 @@ sub wizard_add_entry {
{ label => N("PXE information:"), val => \$WINFO,
help => N("The PXE information is used to explain the role of the boot image,\ne.g.:\nMandrakelinux 10 rescue disk\nMandrakelinux cooker install via http") },
{ label => N("Full path to all.rdz image source:"), val => \$WALLRDZ,
- help => N("Provide the full path to all.rdz image source") },
+ help => N("Provide the full path to all.rdz image location") },
{ label => N("Full path to vmlinuz source:"), val => \$WVMLINUZ,
help => N("Provide the full path to vmlinuz kernel location") },
],
@@ -360,6 +373,12 @@ sub wizard_add_entry {
if (($WPXENAME) !~ /^\w+$/) {
err_dialog(N("Error!"), N("PXE label should be an ASCII word/number without space. Please adjust")) and return 'addimg';
}
+ if (! -f $WALLRDZ) {
+ err_dialog(N("Error!"), N("Please enter a correct path to all.rdz")) and return 'addimg';
+ }
+ if (! -f $WVMLINUZ) {
+ err_dialog(N("Error!"), N("Please enter a correct path to vmlinuz")) and return 'addimg';
+ }
},
next => 'endadd',
post => sub {
@@ -418,6 +437,7 @@ sub wizard_add_entry {
$w->process($wiz, $in);
$::isWizard = 0;
gtkset_mousecursor_normal();
+ gtk->flush;
}
# remove an entry in PXE menu
@@ -639,7 +659,7 @@ sub edit_box_item {
2, gtkadd_widget($size_groups{button}, ""),
),
0, $label_and_widgets->(N("Remote server name"), $server, ""),
- 0, $label_and_widgets->(N("Remote installation directory"), $directory, ""),
+ 0, $label_and_widgets->(N("Remote installation directory"), $directory, $buttondir),
),
),
),
@@ -854,14 +874,19 @@ sub wizard_pxe_server {
undef $::WizardWindow;
$::isWizard = 1;
use wizards;
+ use Net::Interface;
+ my $interface;
+ use MDK::Wizard::Wizcommon;
+ my $wz = new MDK::Wizard::Wizcommon;
my $w = wizards->new;
my $wiz = {
name => N("PXE Wizard"),
-# init => sub {
-# if (($DOMAINNAME eq "") or ($HOSTNAME eq "localhost")) {
-# return 0, N("You need to readjust your domainname, not equal to localdomain or none. Please launch drakconnect to adjust it.")
-# }
-# 1},
+ init => sub {
+ if ($DOMAINNAME eq "" or $HOSTNAME eq "localhost") {
+ return 0, N("You need to readjust your domainname, not equal to localdomain or none. Please launch drakconnect and use a FQDN hostname.")
+ }
+ 1 },
+ needed => { "tftp-server", "pxe", "dhcpd" },
pages => {
welcome => {
name => N("PXE wizard") . "\n\n" . N("Set a PXE server.") . "\n" . N("This wizard will help you to configure 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."),
@@ -871,10 +896,22 @@ sub wizard_pxe_server {
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."),
no_back => 1,
- next => 'summaryserver',
+ next => 'interface',
+ },
+ interface => {
+ name => N("PXE server Interface"),
+ data => [
+ { list => [ keys %{$wz->{net}{itf}} ], val => \$interface },
+ ],
+ no_back => 1,
+ next => 'summaryserver'
},
summaryserver => {
name => N("The wizard will now prepare all default files to set up your PXE server"),
+ pre => sub {
+ ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
+ output($sys_wizard_pxe, "INTERFACE=$interface\n");
+ },
data => [
{ label => N("TFTP directory: %s", $TFTPDIR) },
{ label => N("Boot image path: %s", $IMGPATH) },
@@ -1087,6 +1124,16 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0),
0, Gtk2::Label->new(N("boot:")),
0, $labelscombo,
0, Gtk2::VSeparator->new,
+ 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Reconfigure PXE Server")), 'pxeserver'), clicked => sub {
+ eval { wizard_pxe_server($model, $treeview) };
+ my $err = $@;
+ $::WizardWindow->destroy if defined $::WizardWindow;
+ undef $::WizardWindow;
+ if ($err && $err !~ /wizcancel/) {
+ err_dialog(N("Error"), N("The PXE server wizard has unexpectedly failed:")
+ . "\n\n" . $err);
+ }
+ }),
0, gtksignal_connect(new Gtk2::Button(N("Help")),
clicked => sub { show_help }
),