/[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

Diff of /lib/PXElator/server.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 393 by dpavlin, Tue Sep 8 16:54:35 2009 UTC revision 408 by dpavlin, Wed Sep 9 10:13:08 2009 UTC
# Line 5  use strict; Line 5  use strict;
5    
6  our $base_dir = '/srv/pxelator';  our $base_dir = '/srv/pxelator';
7    
8  tie our $ip,      'server::tie', 'ip'      => '172.16.10.1';  tie our $ip,      'server::tie', 'server_ip' => '172.16.10.1';
9  tie our $netmask, 'server::tie', 'natmask' => '255.255.255.0';  tie our $netmask, 'server::tie', 'natmask'   => '255.255.255.0';
10  tie our $bcast,   'server::tie', 'bcast'   => '172.16.10.254';  tie our $bcast,   'server::tie', 'bcast'     => '172.16.10.254';
11  tie our $ip_from, 'server::tie', 'ip_from' => 10;  tie our $ip_from, 'server::tie', 'ip_from'   => 10;
12  tie our $ip_to,   'server::tie', 'ip_to'   => 100;  tie our $ip_to,   'server::tie', 'ip_to'     => 100;
13  tie our $domain,  'server::tie', 'domain'  => 'pxelator.lan';  tie our $domain,  'server::tie', 'domain'    => 'pxelator.lan';
14    tie our $new_clients, 'server::tie', 'new_clients' => $ip_to - $ip_from;
15    
16  warn "DEV $ip $bcast $netmask";  warn "DEV $ip $bcast $netmask";
17    
18  our $conf = "$base_dir/conf/$ip";  our $conf = "$base_dir/conf";
19  mkdir $conf unless -e $conf;  mkdir $conf unless -e $conf;
20    
21  sub conf {  sub conf {
# Line 67  sub TIESCALAR { Line 68  sub TIESCALAR {
68          warn dump @_;          warn dump @_;
69          my ($class,$name,$default) = @_;          my ($class,$name,$default) = @_;
70    
71          my $path = $server::base_dir;          my $path = $server::base_dir . '/conf/' . $name;
         if ( $name eq 'ip' ) {  
                 $path .= '/conf/' . $ip;  
         } else {  
                 $path .= '/conf/' . $server::ip;  
         }  
72    
73          my $o = {          my $o = {
74                  path => "$path/$name",                  path => $path,
75          };          };
76          write_file $o->{path}, $default unless -f $o->{path};          write_file $o->{path}, $default unless -f $o->{path};
77    
# Line 93  sub STORE { Line 89  sub STORE {
89  sub FETCH {  sub FETCH {
90          warn dump @_;          warn dump @_;
91          my $self = shift;          my $self = shift;
92          read_file $$self->{path};          my $v = read_file $$self->{path};
93            chomp($v);
94            $v;
95  }  }
96    
97  3;  3;

Legend:
Removed from v.393  
changed lines
  Added in v.408

  ViewVC Help
Powered by ViewVC 1.1.26