--- lib/PXElator/pxe.pm 2009/07/29 22:25:42 46 +++ lib/PXElator/pxe.pm 2009/07/31 20:08:06 95 @@ -6,7 +6,7 @@ use File::Slurp; -use server; +use httpd; use tftpd; our $file = 'gpxelinux.0'; @@ -14,23 +14,33 @@ symlink '/usr/lib/syslinux/gpxelinux.0', $path unless -l $path; warn "file $path ", -s $path; -my $url = "http://$server::ip/pxelator/"; -$url = "tftp://$server::ip/"; # fallback to tftp +my $url = $httpd::url; +#$url = "tftp://$server::ip/"; # fallback to tftp +#$url = "http://$server::ip/pxelator/"; -my $squash = tftpd::path('debian-live/*squashfs'); -my $config = "$tftpd::dir/pxelinux.cfg/default"; +sub config_for_ip { -write_file $config, qq{ + my $ip = shift; + $ip = uc sprintf "%02x%02x%02x%02x", split /\./,$ip; -default linux -label linux - kernel $url/debian-live/vmlinuz1 - append initrd=$url/debian-live/initrd1.img boot=live union=aufs noswap noprompt vga=normal fetch=http://$server::ip/pxelator/$squash + my $config = "$tftpd::dir/pxelinux.cfg"; + mkdir $config unless -d $config; + $config .= '/' . $ip; -}; + my $squash = $url . tftpd::path('debian-live/*squashfs'); + write_file $config, qq{ -warn "config $config ", -s $config; + default linux + label linux + kernel $url/debian-live/vmlinuz1 + append initrd=$url/debian-live/initrd1.img boot=live union=aufs noswap noprompt vga=normal fetch=$squash + + }; + + warn "config $config ", -s $config if $server::debug; + +} warn "loaded";