/[pxelator]/lib/PXElator/server.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

Contents of /lib/PXElator/server.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 160 - (show annotations)
Thu Aug 6 18:09:17 2009 UTC (14 years, 8 months ago) by dpavlin
File size: 726 byte(s)
send just requested dhcp options to clients except for server identifier
which busybox udhcpc implementation requires but don't request

1 package server;
2
3 use warnings;
4 use strict;
5
6
7 our $ip = '172.16.10.1';
8 our $netmask = '255.255.255.0';
9 our $bcast = '172.16.10.255';
10
11 our ( $ip_from, $ip_to ) = ( 10, 100 );
12
13 our $domain_name = 'pxelator.lan';
14
15 our $base_dir = '/srv/pxelator';
16
17 our $conf = "$base_dir/conf/$ip";
18
19 use Module::Refresh qw//;
20 sub refresh { Module::Refresh->refresh };
21
22
23 mkdir $_ foreach grep { ! -d $_ } map { "$conf/$_" } ( 'ip', 'mac' );
24
25 use File::Slurp;
26 sub shared {
27 my ($name, $value) = @_;
28
29 my $path ="$conf/$name";
30 if ( defined $value ) {
31 write_file $path, $value;
32 warn "update $path = $value";
33 } else {
34 $value = read_file $path if -e $path;
35 }
36 return $value;
37 }
38
39 sub debug { shared('debug', @_) || 0 }
40
41 warn "loaded";
42
43 1;

  ViewVC Help
Powered by ViewVC 1.1.26