Cisco-Conf

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    print "ok\n";
}

if (!$ok  ||  $recommended) {
    print("\n",
	  "Missing modules are available from any CPAN mirror, for example\n",
	  "\tftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module\n",
	  "\n");
}

if (!$ok) {
    exit 1;
}


use lib "lib";
require Cisco::Conf::Install;
require Cisco::Conf;

if ( -f "configuration" ) {
    $Cisco::Conf::config = Cisco::Conf->_ReadConfigFile("configuration");
} else {
    $Cisco::Conf::config = Cisco::Conf::Install->Install("./configuration",
							 "/usr/local/cisco");
}


ExtUtils::MakeMaker::WriteMakefile(
    'NAME'	   => 'Cisco::Conf',
    'VERSION_FROM' => 'lib/Cisco/Conf.pm',
    'EXE_FILES'    => [ 'cisconf' ],
    'dist'         => { 'SUFFIX'       => ".gz",
			'DIST_DEFAULT' => 'all tardist',
			'COMPRESS'     => "gzip -9f" },
    'realclean'    => { 'FILES' => 'configuration' },
    'clean'        => { 'FILES' => 'cisconf' }
);


package MY;

sub postamble {
    my($config) = $Cisco::Conf::config;

    my $etcdir = $config->{'etc_dir'};
    my $tftpdir = $config->{'tftp_dir'};
    my $perl = $^X;

    <<"EOF";

test :: all
	\$(NOOP)

install ::
	if [ `perl -e 'print \$\$>'` -ne 0 ]; then                           \\
	    echo "Sorry, but you must be root to install this module.";      \\
	    exit 1;                                                          \\
	fi
	$perl -MFile::Path -e 'mkpath(["$etcdir", "$tftpdir"], 1, 0755)'
	chown root \$(INSTALLSCRIPT)/cisconf
	chmod 4755 \$(INSTALLSCRIPT)/cisconf
	chown root $etcdir
	chmod 700 $etcdir
	if [ -f "$etcdir/configuration" ]; then                              \\
	    echo "Not overwriting existing configfile $etcdir/configuration";\\
	else                                                                 \\
	    cp configuration "$etcdir/configuration";                        \\
	fi

EOF
}

sub libscan {
    my($self, $path) = @_;
    if ($path =~ /\~$/) {
	undef;
    } else {
	$path;
    }
}



( run in 0.482 second using v1.01-cache-2.11-cpan-fe3c2283af0 )