aboutsummaryrefslogtreecommitdiffstats
path: root/lib/LXRng/Repo/Directory.pm
blob: ad892b2f7e1ef7ea1b4a0d99a2c63d741f01dab5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package LXRng::Repo::Directory;

use strict;

sub name {
    my ($self) = @_;

    return $$self{'name'};
}

sub node {
    my ($self) = @_;

    $self->name =~ m,([^/]+)/?$, and return $1;
}

1;
Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/usr/bin/perl -I /root/tgmanage
use strict;

use Net::IP;
use Net::IP qw(:PROC);

BEGIN {
        require "include/config.pm";
        eval {
                require "include/config.local.pm";
        };
}

my $base = "/etc";
$base = $ARGV[0] if $#ARGV > -1;
$base .= "/" if not $base =~ m/\/$/ and not $base eq "";

my $dhcpd_base = $base . "dhcp/";
my $dhcpd_conf =  $dhcpd_base . "dhcpd.conf";
my $dhcp_pxeconf =  $dhcpd_base . "pxe-boot.conf";
my $dhcp_ciscoapconf =  $dhcpd_base . "ciscowlc.conf";

my $tgname    = $nms::config::tgname;
my $pri_ptr   = $nms::config::pri_ptr;
my $pri_net   = $nms::config::pri_net;
my $sec_ptr   = $nms::config::sec_ptr;
my $pxe_server = $nms::config::pxe_server;
my $ddns_key  = $nms::config::ddns_key;
my $ciscowlc_a  = $nms::config::ciscowlc_a;

my $range = new Net::IP( $pri_net ) or die ("oopxos");
my $mask = $range->mask();	
my ($net, undef) = split "/", $pri_net;


# Create PXE-boot configuration file for DHCP on master.
if ( not -f $dhcpd_conf )
{
		print STDERR "Creating file " . $dhcpd_conf . "\n";
		open DHCPDFILE, ">" . $dhcpd_conf or die ( $! . " " . $dhcpd_conf);

		print DHCPDFILE <<"EOF";
# GENERATED BY make-dhcpd.pl
#
# Central concept: as little config in the main .conf,
# include almost everything from separate files..
#
# log-facility local7;
option domain-name "$tgname.gathering.org";
option domain-name-servers $pri_ptr, $sec_ptr;
default-lease-time 3600;
max-lease-time 7200;
authoritative;

ddns-update-style interim;
key DHCP_UPDATER {
        algorithm HMAC-MD5.SIG-ALG.REG.INT;
        secret $ddns_key;
}

subnet $net netmask $mask {}

include "/etc/dhcp/revzones.conf";
include "/etc/dhcp/generated-include.conf";
include "/etc/dhcp/pxe-boot.conf";
include "/etc/dhcp/ciscowlc.conf";

EOF
		close DHCPDFILE;
}

# Create PXE-boot configuration file for DHCP on master.
if ( not -f $dhcp_pxeconf )
{
		print STDERR "Creating file " . $dhcp_pxeconf . "\n";
		open PXEFILE, ">" . $dhcp_pxeconf or die ( $! . " " . $dhcp_pxeconf);

		print PXEFILE "next-server " . $pxe_server . ";\n";
		print PXEFILE "filename \"pxelinux.0\";\n";

		close PXEFILE;
}


# Create PXE-boot configuration file for DHCP on master.
if ( not -f $dhcp_ciscoapconf )
{
		print STDERR "Creating file " . $dhcp_ciscoapconf . "\n";
		open CISCOFILE, ">" . $dhcp_ciscoapconf or die ( $! . " " . $dhcp_pxeconf);

		print CISCOFILE <<"EOF";
option space CiscoAP;
option CiscoAP.server-address code 241 = array of ip-address;
set vendor-string = option vendor-class-identifier;

class "cisco-aps" {
       match if substring (option vendor-class-identifier, 0, 8) = "Cisco AP";
       vendor-option-space CiscoAP;
       option CiscoAP.server-address $ciscowlc_a;
}
EOF
		close CISCOFILE;
}