do everything once keyed on local file
[pxelator] / conf / debian-live / config.pl
1
2 use warnings;
3
4 $tftp_dir = 'tftp/debian-live';
5 $file = 'gpxelinux.0';
6 symlink '/usr/lib/syslinux/gpxelinux.0', "$tftp_dir/$file" unless -l "$tftp_dir/$file";
7
8 sub path {
9         my $glob = shift;
10         my $path = glob("$tftp_dir/$glob");
11         die "can't find anything for $tftp_dir/$glob" unless $path;
12 warn $path;
13         $path =~ s{^$tftp_dir}{};
14         return "/$path";
15 }
16
17 my $pxelinux = "$tftp_dir/pxelinux.cfg";
18
19 if ( $server_ip ) { # FIXME refresh only from dhcpd
20         mkdir $pxelinux;
21         $pxelinux .= '/default';
22
23         my $url = "http://$server_ip/pxelator/debian-live/";
24 #       $url = '';
25
26         my $squash = path '*squashfs';
27
28         use File::Slurp qw/write_file/;
29         write_file $pxelinux, qq{
30 default linux
31 label linux
32         kernel $url/vmlinuz1
33         append initrd=$url/initrd1.img boot=live union=aufs noswap noprompt vga=normal fetch=$url/$squash
34         };
35
36         warn "created $pxelinux $squash\n";
37 } else {
38         warn "using $pxelinux";
39 }
40
41 1;