/[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 156 - (show annotations)
Thu Aug 6 15:15:53 2009 UTC (14 years, 8 months ago) by dpavlin
File size: 694 byte(s)
implement client::conf to fetch/set (with default) client configuration

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

  ViewVC Help
Powered by ViewVC 1.1.26