diff options
-rw-r--r-- | pxe_wizard/Pxe.pm | 28 |
1 files changed, 25 insertions, 3 deletions
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 <aginies _ateuh _ mandrakesoft.com> @@ -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; |