/[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 103 - (hide annotations)
Fri Jul 31 22:52:04 2009 UTC (11 years, 9 months ago) by dpavlin
File size: 1358 byte(s)
mirror upstream requirements for Debian live
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 102 use LWP::Simple qw/mirror RC_NOT_MODIFIED/;
22 dpavlin 103 foreach my $file ( 'vmlinuz1', 'initrd1.img', 'debian-live-501-i386-standard.squashfs' ) {
23 dpavlin 102 my $path = "$tftpd::dir/debian-live";
24     mkdir $path unless -e $path;
25     # next if -e "$path/$file";
26     print STDERR "mirror $file ";
27     mirror( "http://cdimage.debian.org/cdimage/release/current-live/i386/web/$file", "$path/$file")
28     == RC_NOT_MODIFIED
29     && warn("not modified\n")
30     || warn("mirrored ", -s "$path/$file", "\n")
31     ;
32     }
33 dpavlin 45
34 dpavlin 63 sub config_for_ip {
35 dpavlin 45
36 dpavlin 63 my $ip = shift;
37     $ip = uc sprintf "%02x%02x%02x%02x", split /\./,$ip;
38 dpavlin 45
39 dpavlin 63 my $config = "$tftpd::dir/pxelinux.cfg";
40     mkdir $config unless -d $config;
41     $config .= '/' . $ip;
42 dpavlin 45
43 dpavlin 68 my $squash = $url . tftpd::path('debian-live/*squashfs');
44 dpavlin 63 write_file $config, qq{
45 dpavlin 45
46 dpavlin 63 default linux
47     label linux
48     kernel $url/debian-live/vmlinuz1
49 dpavlin 68 append initrd=$url/debian-live/initrd1.img boot=live union=aufs noswap noprompt vga=normal fetch=$squash
50 dpavlin 45
51 dpavlin 63 };
52    
53 dpavlin 95 warn "config $config ", -s $config if $server::debug;
54 dpavlin 63
55     }
56    
57 dpavlin 45 warn "loaded";
58    
59     1;

  ViewVC Help
Powered by ViewVC 1.1.26