6 our $base_dir = '/srv/pxelator';
10 tie our $ip, 'ties', 'server_ip' => '172.16.10.1';
11 tie our $netmask, 'ties', 'netmask' => '255.255.255.0';
12 tie our $bcast, 'ties', 'bcast' => '172.16.10.254';
13 tie our $ip_from, 'ties', 'ip_from' => 10;
14 tie our $ip_to, 'ties', 'ip_to' => 100;
15 tie our $domain, 'ties', 'domain' => 'pxelator.lan';
16 tie our $new_clients, 'ties', 'new_clients' => $ip_to - $ip_from;
18 warn "DEV $ip $bcast $netmask";
20 our $conf = "$base_dir/conf";
21 mkdir $conf unless -e $conf;
28 use Module::Refresh qw//;
30 Module::Refresh->refresh;
31 my $from = (caller(1))[3];
32 $from =~ s{^(\w+)::.+$}{$1};
33 my $eval = '$' . $from . '::debug = server::debug();';
34 warn "refresh $eval\n";
39 mkdir $_ foreach grep { ! -d $_ } map { "$conf/$_" } ( 'ip', 'mac' );
43 my ($name, $value) = @_;
45 my $path ="$conf/$name";
46 if ( defined $value ) {
47 write_file $path, $value;
48 warn "update $path = $value";
50 $value = read_file $path if -e $path;
55 sub conf_default { shared($_[0]) || $_[1] }
57 sub debug { shared('debug', @_) || 0 }