2 |
|
|
3 |
use warnings; |
use warnings; |
4 |
use strict; |
use strict; |
5 |
|
use autodie; |
6 |
|
|
7 |
use server; |
use server; |
8 |
use pxelinux; |
use pxelinux; |
26 |
$pxelinux::config_file = 'pxelinux.cfg/default'; |
$pxelinux::config_file = 'pxelinux.cfg/default'; |
27 |
} |
} |
28 |
|
|
29 |
|
use LWP::Simple qw/mirror RC_NOT_MODIFIED/; |
30 |
sub webconverger { |
sub webconverger { |
31 |
$dhcpd::file = "pxelinux.0"; |
$dhcpd::file = "pxelinux.0"; |
32 |
$pxelinux::path_prefix = 'webconverger/'; |
$pxelinux::path_prefix = 'webconverger/'; |
|
# $pxelinux::config_file = 'default'; |
|
33 |
|
|
34 |
return; # FIXME |
my $dir = "$server::base_dir/tftp/$pxelinux::path_prefix"; |
35 |
|
|
36 |
my $cfg = "$tftp::dir/pxelinux.cfg"; |
mkdir $dir unless -d $dir; |
|
return if -e $cfg; |
|
37 |
|
|
38 |
warn "using iso"; |
my $cfg = "$dir/pxelinux.cfg"; |
39 |
# system "mount -t 9660 | grep webc-5.2 || sudo mount /srv/pxelator/iso/webc-5.2.iso /srv/pxelator/tftp/webconverger/iso/ -o loop -t iso9660 -v"; |
return 1 if -e $cfg; |
40 |
|
|
41 |
symlink "/usr/lib/syslinux/pxelinux.0", "$tftp::dir/$dhcpd::file"; |
mkdir $cfg; |
42 |
|
|
43 |
|
my $iso = '/srv/pxelator/iso/webc-5.2.iso'; |
44 |
|
my $url = 'http://download.webconverger.com/webc-5.2.iso'; |
45 |
|
|
46 |
|
print STDERR "mirror $url"; |
47 |
|
mirror( $url, $iso) |
48 |
|
== RC_NOT_MODIFIED |
49 |
|
&& warn(" not modified\n") |
50 |
|
|| warn(" done ", -s $iso, " bytes\n") |
51 |
|
; |
52 |
|
|
53 |
|
mkdir "$dir/iso" unless -e "$dir/iso"; |
54 |
|
|
55 |
|
system "mount -t iso9660 | grep webc-5.2 || sudo mount $iso $dir/iso/ -o loop -t iso9660 -v"; |
56 |
|
|
57 |
|
symlink "/usr/lib/syslinux/pxelinux.0", "$dir/$dhcpd::file"; |
58 |
|
|
59 |
|
$cfg .= '/default'; |
60 |
|
|
61 |
|
write_file $cfg, qq{ |
62 |
|
label webconverger |
63 |
|
kernel iso/live/vmlinuz-2.6.30-backports.1-486 |
64 |
|
append initrd=iso/live/initrd.img-2.6.30-backports.1-486 fetch=http://172.16.10.1/pxelator/webconverger/iso/live/filesystem.squashfs boot=live quiet homepage=http://172.16.10.1:7777/ nonetworking nosudo splash video=vesa:ywrap,mtrr vga=788 nopersistent username=webc hostname=webconverger union=aufs |
65 |
|
}; |
66 |
|
|
67 |
|
# $pxelinux::config_file = $cfg; |
68 |
} |
} |
69 |
|
|
70 |
sub for_ip { |
sub for_ip { |
74 |
# $tftp::dir = "$server::base_dir/tftp/$pxelinux::path_prefix"; |
# $tftp::dir = "$server::base_dir/tftp/$pxelinux::path_prefix"; |
75 |
} |
} |
76 |
|
|
77 |
|
warn 'loaded'; |
78 |
|
|
79 |
1; |
1; |