1 |
package pxe; |
2 |
|
3 |
use warnings; |
4 |
use strict; |
5 |
use autodie; |
6 |
|
7 |
use File::Slurp; |
8 |
|
9 |
use httpd; |
10 |
use tftpd; |
11 |
|
12 |
our $file = 'gpxelinux.0'; |
13 |
my $path = "$tftpd::dir/$file"; |
14 |
symlink '/usr/lib/syslinux/gpxelinux.0', $path unless -l $path; |
15 |
warn "file $path ", -s $path; |
16 |
|
17 |
my $url = $httpd::url; |
18 |
$url = "tftp://$server::ip/"; # fallback to tftp |
19 |
$url = "http://$server::ip/pxelator/"; |
20 |
|
21 |
my $squash = tftpd::path('debian-live/*squashfs'); |
22 |
|
23 |
my $config = "$tftpd::dir/pxelinux.cfg"; |
24 |
mkdir $config unless -d $config; |
25 |
$config .= '/default'; |
26 |
|
27 |
write_file $config, qq{ |
28 |
|
29 |
default linux |
30 |
label linux |
31 |
kernel $url/debian-live/vmlinuz1 |
32 |
append initrd=$url/debian-live/initrd1.img boot=live union=aufs noswap noprompt vga=normal fetch=$url/$squash |
33 |
|
34 |
}; |
35 |
|
36 |
warn "config $config ", -s $config; |
37 |
|
38 |
warn "loaded"; |
39 |
|
40 |
1; |