diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2015-04-01 21:10:11 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2015-04-01 21:10:11 +0300 |
commit | aa0a3f7cbd7fd1b230386f434ad472bc06f01b6e (patch) | |
tree | ceff5f76bc521497c01116232fbe31489d8de240 | |
parent | 74828acdf2dcce9e66318a2852ec4473364c7458 (diff) | |
download | dnstools-aa0a3f7cbd7fd1b230386f434ad472bc06f01b6e.tar.gz dnstools-aa0a3f7cbd7fd1b230386f434ad472bc06f01b6e.tar.bz2 |
nsdbimport: add makefiles
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | nsdbimport/GNUmakefile | 2 | ||||
-rw-r--r-- | nsdbimport/MANIFEST | 5 | ||||
-rw-r--r-- | nsdbimport/Makefile.PL | 37 | ||||
-rwxr-xr-x | nsdbimport/nsdbimport | 22 |
5 files changed, 64 insertions, 4 deletions
@@ -16,3 +16,3 @@ -SUBDIRS = dnsdbck rpsl2acl axfr2acl vhostcname renewck whoseip +SUBDIRS = dnsdbck rpsl2acl axfr2acl vhostcname renewck whoseip nsdbimport diff --git a/nsdbimport/GNUmakefile b/nsdbimport/GNUmakefile new file mode 100644 index 0000000..e61b3c3 --- /dev/null +++ b/nsdbimport/GNUmakefile @@ -0,0 +1,2 @@ +include ../Make.vars +include ../Make.rules diff --git a/nsdbimport/MANIFEST b/nsdbimport/MANIFEST new file mode 100644 index 0000000..822ea34 --- /dev/null +++ b/nsdbimport/MANIFEST @@ -0,0 +1,5 @@ +MANIFEST +Makefile.PL +inc/ExtUtils/AutoInstall.pm +nsdbimport + diff --git a/nsdbimport/Makefile.PL b/nsdbimport/Makefile.PL new file mode 100644 index 0000000..9deb44e --- /dev/null +++ b/nsdbimport/Makefile.PL @@ -0,0 +1,37 @@ +# -*- perl -*- +# Copyright (C) 2015 Sergey Poznyakoff <gray@gnu.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use lib 'inc'; +use ExtUtils::AutoInstall ( + -core => [ + 'Getopt::Long' => 2.34, + 'Pod::Usage' => 1.51, + 'Pod::Man' => 2.25, + 'DBI' => 1.607, + 'String::Regexp' => 1.00 + ] +); + +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. +WriteMakefile( + 'NAME' => 'nsdbimport', + 'AUTHOR' => 'Sergey Poznyakoff <gray@gnu.org>', + 'ABSTRACT' => 'converts BIND zone files to SQL database', + 'FIRST_MAKEFILE' => 'Makefile', + 'VERSION' => '1.00', + 'EXE_FILES' => [ 'nsdbimport' ], +); diff --git a/nsdbimport/nsdbimport b/nsdbimport/nsdbimport index dc93c6d..7c72f71 100755 --- a/nsdbimport/nsdbimport +++ b/nsdbimport/nsdbimport @@ -38,2 +38,3 @@ my $debug; my $dry_run; +my $verbose; my $bind_directory; @@ -42,2 +43,3 @@ my $dbd; my $generate_seen; +my $record_count; @@ -63,2 +65,8 @@ sub abend { +END { + if ($record_count and ($verbose or $?)) { + print "$progname: $record_count records processed successfully\n"; + } +} + my %config; @@ -197,2 +205,3 @@ sub sql_query { } + ++$record_count; } @@ -415,2 +424,3 @@ GetOptions("h" => sub { "debug|d+" => \$debug, + "verbose|v+" => \$verbose, "dry-run|n" => \$dry_run, @@ -468,3 +478,3 @@ $dbd = DBI->connect($arg, $config{user}, $config{password}, { PrintError => 0, AutoCommit => 1}) - or exit(EX_UNAVAILABLE); + or abend(EX_UNAVAILABLE, "can't connect to the database: ".$DBI::errstr); @@ -495,3 +505,3 @@ nsdbimport - import data from BIND-compatible zone files to SQL database B<nsdbimport> -[B<-dhn>] +[B<-dhnv>] [B<-C> I<DIR>] @@ -506,3 +516,4 @@ B<nsdbimport> [B<--origin=>I<ZONE>] -[B<--usage>] +[B<--usage>] +[B<--verbose>] [I<ZONEFILE>...] @@ -559,2 +570,7 @@ Set initial origin. Useful when processing individual files. +=item B<-v>, B<--verbose> + +Verbose mode. Report count of successfully processed records at the +end of the run. + =back |