/[pxelator]/lib/PXElator/pxe.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /lib/PXElator/pxe.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 64 - (hide annotations)
Thu Jul 30 16:26:54 2009 UTC (11 years, 9 months ago) by dpavlin
File size: 875 byte(s)
show server ip and netmask

1 dpavlin 45 package pxe;
2    
3     use warnings;
4     use strict;
5 dpavlin 46 use autodie;
6 dpavlin 45
7     use File::Slurp;
8    
9 dpavlin 60 use httpd;
10 dpavlin 45 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 dpavlin 60 my $url = $httpd::url;
18 dpavlin 64 #$url = "tftp://$server::ip/"; # fallback to tftp
19     #$url = "http://$server::ip/pxelator/";
20 dpavlin 46
21 dpavlin 45 my $squash = tftpd::path('debian-live/*squashfs');
22    
23 dpavlin 63 sub config_for_ip {
24 dpavlin 45
25 dpavlin 63 my $ip = shift;
26     $ip = uc sprintf "%02x%02x%02x%02x", split /\./,$ip;
27 dpavlin 45
28 dpavlin 63 my $config = "$tftpd::dir/pxelinux.cfg";
29     mkdir $config unless -d $config;
30     $config .= '/' . $ip;
31 dpavlin 45
32 dpavlin 63 write_file $config, qq{
33 dpavlin 45
34 dpavlin 63 default linux
35     label linux
36     kernel $url/debian-live/vmlinuz1
37     append initrd=$url/debian-live/initrd1.img boot=live union=aufs noswap noprompt vga=normal fetch=$url/$squash
38 dpavlin 45
39 dpavlin 63 };
40    
41     warn "config $config ", -s $config;
42    
43     }
44    
45 dpavlin 45 warn "loaded";
46    
47     1;

  ViewVC Help
Powered by ViewVC 1.1.26