summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2004-08-12 03:24:28 +0000
committerAntoine Ginies <aginies@mandriva.com>2004-08-12 03:24:28 +0000
commit9e65445176fd172c83e8cea87017c9f1269fcc97 (patch)
treeccf4e2e2a19544a7fcd5de7dc8d81bf8aa7757e3 /drakpxelinux.pl
parent56f1db53834e39a0a0b9c84f5278464807fbfe75 (diff)
downloaddrakpxelinux-9e65445176fd172c83e8cea87017c9f1269fcc97.tar
drakpxelinux-9e65445176fd172c83e8cea87017c9f1269fcc97.tar.gz
drakpxelinux-9e65445176fd172c83e8cea87017c9f1269fcc97.tar.bz2
drakpxelinux-9e65445176fd172c83e8cea87017c9f1269fcc97.tar.xz
drakpxelinux-9e65445176fd172c83e8cea87017c9f1269fcc97.zip
add a check of pxe.conf file
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r--drakpxelinux.pl30
1 files changed, 19 insertions, 11 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index da0f15d..5a541e5 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -57,7 +57,7 @@ my $SYSLINUXPATH = '/usr/lib/syslinux/';
my $MEMDISK = $SYSLINUXPATH . '/memdisk';
my $XINETDDIR = "/etc/xinetd.d";
-my $interface = 'eth0';
+my $interface = 'eth1';
my ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
my $DOMAINNAME = chomp_(`dnsdomainname`);
@@ -305,9 +305,9 @@ sub wizard_add_entry {
my $WPXENAME = "Mandrakeclustering";
my $WINFO = "install Mandrakeclustering";
# my $WALLRDZ = "/home/nis/install/clic/isolinux/alt0/all.rdz";
- my $WALLRDZ = "/mnt/ken/dis/10.0/i586/isolinux/alt0/all.rdz";
+ my $WALLRDZ = "/tmp/all.rdz";
# my $WVMLINUZ = "/home/nis/install/clic/isolinux/alt0/vmlinuz";
- my $WVMLINUZ = "/mnt/ken/dis/10.0/i586/isolinux/alt0/vmlinuz";
+ my $WVMLINUZ = "/tmp/vmlinuz";
my $w = wizards->new;
my $wiz = {
name => N("Add PXE entry"),
@@ -332,9 +332,8 @@ sub wizard_add_entry {
if (any { /^$WPXENAME :/ } cat_($PXEHELP)) {
err_dialog(N("Error!"), N("Found a similar entry in PXE list labeled : %s.\nChoose another label please", $WPXENAME)) and return 'addimg';
}
- if ($WPXENAME != /^\d+$/) {
- err_dialog(N("Error!"), N("PXE label should be a name/number without space. Please adjust"));
- return 'addimg';
+ if (($WPXENAME) !~ /^\w+$/) {
+ err_dialog(N("Error!"), N("PXE label should be a name/number without space. Please adjust")) and return 'addimg';
}
},
next => 'endadd',
@@ -763,7 +762,7 @@ sub show_help { info_dialog("help",
0, $help,
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("online PXE documentation")), 'helponline'),
# FIXME: we lacks a web programe here:
- clicked => sub { open(F, "http://clic.mandrakesoft.com/documentation/pxe/ |") }
+ clicked => sub { open(F, "mozilla http://clic.mandrakesoft.com/documentation/pxe/ |") }
),
),
)
@@ -779,6 +778,13 @@ sub pxe_conf {
} $pxeconf;
}
+sub check_pxe_conf {
+ if (! any { /default_address=$IPSERVER/ } cat_($pxeconf)) {
+ # pxe.conf doesnt matche system, relaunch wizard_pxe_server
+ err_dialog(N("Error !"), N("Your %s doesnt match your actual IP address configuration. Relaunching the PXE wizard server to readjust it.", $pxeconf)) and launch_pxe_server();
+ }
+}
+
# launch wizard to setup a PXE server
sub wizard_pxe_server {
local $::isEmbedded = 0;
@@ -950,6 +956,11 @@ sub add_columns {
# check if first launch
if (! -f "$X86/drakwizard_pxe") {
info_dialog(N("Please configure a PXE server"), N("Its seems this is the first time you run this tool.\n") . ("A wizard will apppear to configure your pxe server."));
+ launch_pxe_server();
+}
+check_pxe_conf();
+
+sub launch_pxe_server {
eval { wizard_pxe_server() };
my $err = $@;
$::WizardWindow->destroy if defined $::WizardWindow;
@@ -989,7 +1000,6 @@ $labelscombo->set_popdown_strings("", sort(@o));
$labelscombo->entry->set_text($defaultlabel);
set_help_tip($labelscombo, 'labels');
-my $banner = Gtk2::Banner->new('wiz_default_up', ("DrakPXE default configuration file"));
my $okcancel = create_okcancel({
cancel_clicked => sub { ugtk2->exit },
ok_clicked => &write_conf_pxe,
@@ -999,11 +1009,8 @@ my $okcancel = create_okcancel({
# main interface
$W->add(gtkpack_(Gtk2::VBox->new(0,0),
- if_(! $::isEmbedded, 0, $banner ),
1, create_scrolled_window($treeview),
0, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 3),
- 0, Gtk2::VSeparator->new(),
- 0, Gtk2::VSeparator->new,
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Add PXE entry")), 'addpxe'), clicked => sub {
eval { wizard_add_entry($model, $treeview) };
my $err = $@;
@@ -1022,6 +1029,7 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0),
),
0, Gtk2::Label->new(N("boot:")),
0, $labelscombo,
+ 0, Gtk2::VSeparator->new(),
0, gtksignal_connect(new Gtk2::Button(N("Help")),
clicked => sub { show_help }
),