From 331d609c186f82e14520d59747e1c6a7273ca5bb Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Tue, 20 Jan 2004 17:06:13 +0000 Subject: - add domainanme test - now configure /etc/pxe.conf --- pxe_wizard/Pxe.pm | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'pxe_wizard') diff --git a/pxe_wizard/Pxe.pm b/pxe_wizard/Pxe.pm index 25c0ef2b..a3f6209f 100644 --- a/pxe_wizard/Pxe.pm +++ b/pxe_wizard/Pxe.pm @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # Drakwizard PXE -# release 0.2 +# release 0.3 # Copyright (C) 2004 Mandrakesoft # # Author: Antoine Ginies @@ -42,14 +42,20 @@ my $PXEHELP = $X86 . '/help.txt'; my $PXEMESSAGE = $X86 . '/messages'; my $PXEDEFAULT = $X86 . '/pxelinux.cfg/default'; -my $CONF = '/etc/pxe.conf'; +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"); +my $interface = 'eth0'; +my ($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_(`domainname`); + my $o = { - name => N("PXE Wizard (devel)"), + name => N("PXE Wizard"), var => { IMG => '/var/install/92/images/network.img', PXENAME => '92', @@ -61,6 +67,12 @@ my $o = { i => '', }, needed_rpm => [ 'pxe', 'tftp-server', 'xinetd' ], + init => sub { + if (member($DOMAINNAME, qw(localdomain (none)))) { + return (0, N("You need to readjust your domainname. For a DNS server you need a correct domainname, not egal to localdomain or none. Launch drakconnect to adjust it.")) + } + 1 + }, }; my %level = ( @@ -454,6 +466,15 @@ EOF } } +sub pxe_conf { + if (!-f "$pxeconf.orig") { cp_af($pxeconf, "$pxeconf.orig") } + substInFile { + s/default_address.*/default_address=$IPSERVER/; + s/mtftp_address.*/mtftp_address=$IPSERVER/; + s/domain.*/domain=$DOMAINNAME/; + } $pxeconf; +} + # set PXE server sub do_it_pxe { return if $::testing; @@ -464,6 +485,7 @@ sub do_it_pxe { default_pxe_menu(); default_pxe_messages(); enable_tftps(); + pxe_conf(); tftp_blksize('N'); map { system("service $_ restart"); $_ } qw(xinetd pxe); undef $w; -- cgit v1.2.1