tie our $domain, 'ties', 'domain' => 'pxelator.lan';
tie our $new_clients, 'ties', 'new_clients' => $ip_to - $ip_from;
+if ( my $dev = $ENV{DEV} ) {
+ my $ifconfig = `ifconfig $dev`;
+ die "can't ifconfig $dev" unless $ifconfig;
+ die "device $dev not up: ifconfig $dev\n$ifconfig" unless $ifconfig =~ m/UP/;
+ $ip = $1 if $ifconfig =~ m/inet addr:(\S+)/s;
+ $netmask = $1 if $ifconfig =~ m/Mask:(\S+)/s;
+ $bcast = $1 if $ifconfig =~ m/Bcast:(\S+)/s;
+}
+
warn "DEV $ip $bcast $netmask";
our $conf = "$base_dir/conf";
map { $server->{ $_ } = eval '$server::' . $_ } ( 'ip', 'netmask', 'bcast', 'domain', 'ip_from', 'ip_to', 'new_clients' );
my $server_path = "$server::conf/ip/$ip/server.yaml";
- $server = YAML::LoadFile $server_path if -e $server_path;
+ if ( -e $server_path ) {
+ my $overlay = YAML::LoadFile $server_path;
+ $server->{$_} = $overlay->{$_} foreach keys %$overlay;
+ }
return $server;
}