1 |
package config; |
2 |
|
3 |
use warnings; |
4 |
use strict; |
5 |
|
6 |
use server; |
7 |
use pxelinux; |
8 |
use File::Slurp; |
9 |
|
10 |
sub shared { |
11 |
my ($name, $value) = @_; |
12 |
|
13 |
my $path ="$server::base_dir/conf/$server::ip/$name"; |
14 |
if ( defined $value ) { |
15 |
write_file $path, $value; |
16 |
} else { |
17 |
$value = read_file $path if -e $path; |
18 |
} |
19 |
return $value; |
20 |
} |
21 |
|
22 |
sub debian_live { |
23 |
$dhcpd::file = "pxelinux.0"; |
24 |
$pxelinux::path_prefix = 'live-helper/tftpboot/'; |
25 |
$pxelinux::config_file = 'pxelinux.cfg/default'; |
26 |
} |
27 |
|
28 |
sub webconverger { |
29 |
$dhcpd::file = "pxelinux.0"; |
30 |
$pxelinux::path_prefix = 'webconverger/'; |
31 |
# $pxelinux::config_file = 'default'; |
32 |
|
33 |
return; # FIXME |
34 |
|
35 |
my $cfg = "$tftp::dir/pxelinux.cfg"; |
36 |
return if -e $cfg; |
37 |
|
38 |
warn "using iso"; |
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"; |
40 |
|
41 |
symlink "/usr/lib/syslinux/pxelinux.0", "$tftp::dir/$dhcpd::file"; |
42 |
|
43 |
} |
44 |
|
45 |
sub for_ip { |
46 |
my $ip = shift; |
47 |
# debian_live(); |
48 |
webconverger(); |
49 |
# $tftp::dir = "$server::base_dir/tftp/$pxelinux::path_prefix"; |
50 |
} |
51 |
|
52 |
1; |