Changeset 522
- Timestamp:
- 06/12/13 17:03:30 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tiny-import.pl
r520 r522 37 37 conv => 0, 38 38 trial => 0, 39 legacy => 0, 39 40 ); 40 41 # Handle some command-line arguments 41 42 while ($ARGV[0] =~ /^-/) { 42 43 my $arg = shift @ARGV; 43 usage() if $arg !~ /^-[rc t]+$/;44 usage() if $arg !~ /^-[rclt]+$/; 44 45 # -r rewrite imported files to comment imported records 45 46 # -c coerce/downconvert A+PTR = records to PTR 47 # -l swallow A+PTR as-is 46 48 # -t trial mode; don't commit to DB or actually rewrite flatfile (disables -r) 47 49 $arg =~ s/^-//; … … 50 52 $importcfg{rw} = 1 if $_ eq 'r'; 51 53 $importcfg{conv} = 1 if $_ eq 'c'; 54 $importcfg{legacy} = 1 if $_ eq 'l'; 52 55 $importcfg{trial} = 1 if $_ eq 't'; 53 56 } … … 65 68 Multiple passes may be necessary if SOA and = records are heavily 66 69 intermixed and not clustered together. 70 -l (for "legacy") Force import of A+PTR records as-is. Mutually exclusive 71 with -c. -l takes precedence as -c is lossy. 67 72 -t Trial run mode; spits out records that would be left unimported. 68 73 Disables -r if set. … … 272 277 $recsth->execute($fparent, $rparent, $host, 65280, $ip, 0, 0, 0, $ttl, $loc); 273 278 } else { 274 if ($importcfg{conv}) { 279 if ($importcfg{legacy}) { 280 # Just import it already! Record may still be subject to downconversion on editing. 281 $fparent = 0 if !$fparent; 282 $rparent = 0 if !$rparent; 283 if ($fparent || $rparent) { 284 $recsth->execute($fparent, $rparent, $host, 65280, $ip, 0, 0, 0, $ttl, $loc); 285 } else { 286 # No parents found, cowardly refusing to add a dangling record 287 push @deferred, $rec unless $nodefer; 288 $impok = 0; 289 } 290 } elsif ($importcfg{conv}) { 275 291 # downconvert A+PTR if forward zone is not found 276 292 $recsth->execute(0, $rparent, $host, 12, $ip, 0, 0, 0, $ttl, $loc);
Note:
See TracChangeset
for help on using the changeset viewer.