package pxe;

use warnings;
use strict;
use autodie;

use File::Slurp;

use server;
use tftpd;

our $file = 'gpxelinux.0';
my $path = "$tftpd::dir/$file";
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 $squash = tftpd::path('debian-live/*squashfs');

my $config = "$tftpd::dir/pxelinux.cfg/default";

write_file $config, qq{

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

};

warn "config $config ", -s $config;

warn "loaded";

1;
