Skip to content

Commit

Permalink
-- BIG CHANGE: Continuation character is NO LONGER "\". destinations.…
Browse files Browse the repository at this point in the history
…txt and hostdb.txt now have continuation lines like a "Makefile" i.e. if the next line is indented, is is part of the previous line. ([email protected])

-- Added smoke-test:  "make test" runs a simple configuration and compares it to a "known good". ([email protected])
-- mkzones now has "-o" option to specify output directory (Thanks Tim Bell and Geoff Crompton of Trinity College, The University of Melbourne)
-- bin/checkrootcache now uses "wget" instead of "ftp".  (Thanks Geoff Crompton of Trinity College, The University of Melbourne)
-- zoneinfo.txt now has a "TTL" command to set the default TTL for a zone.  (Thanks Geoff Crompton of Trinity College, The University of Melbourne)
-- Consistantly use "bash" (not /bin/sh) in shell scripts, move Copyright to be next to shebang line ([email protected])
-- HINFO records are now RFC-compliant (Thanks to Pancho Horrillo <[email protected]>)
  • Loading branch information
yesthattom committed May 26, 2009
1 parent fbddf5a commit 1973335
Show file tree
Hide file tree
Showing 44 changed files with 1,116 additions and 207 deletions.
25 changes: 15 additions & 10 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ Copyright 2005 Thomas A. Limoncelli

CONTACT INFORMATION:

The author and maintainer: Thomas "Tom" A. Limoncelli <[email protected]>
http://www.everythingsysadmin.com/hostdb
Join the mailing list: http://whatexit.org/mailman/listinfo/hostdb-fans
The author and maintainer: Thomas A. Limoncelli <[email protected]>
Join the mailing list: http://lists.everythingsysadmin.com/mailman/listinfo/hostdb-fans
New homepage: http://code.google.com/p/hostdb/
Old homepage: http://www.everythingsysadmin.com/hostdb


RELEASE HISTORY:
Expand Down Expand Up @@ -88,10 +89,13 @@ examples:
1.005 -- INSERT DATE

New features:
-- BIG CHANGE: Continuation character is NO LONGER "\". destinations.txt and hostdb.txt now have continuation lines like a "Makefile" i.e. if the next line is indented, is is part of the previous line. ([email protected])
-- Added smoke-test: "make test" runs a simple configuration and compares it to a "known good". ([email protected])
-- mkzones now has "-o" option to specify output directory (Thanks Tim Bell and Geoff Crompton of Trinity College, The University of Melbourne)
-- bin/checkrootcache now uses "wget" instead of "ftp". (Thanks Geoff Crompton of Trinity College, The University of Melbourne)
-- zoneinfo.txt now has a "TTL" command to set the default TTL for a zone. (Thanks Geoff Crompton of Trinity College, The University of Melbourne)
-- Added smoke-test: "make test" runs a simple configuration and compares it to a "known good".
-- Consistantly use "bash" (not /bin/sh) in shell scripts, move Copyright to be next to shebang line ([email protected])
-- HINFO records are now RFC-compliant (Thanks to Pancho Horrillo <[email protected]>)

TODO / Wishlist:

Expand All @@ -101,11 +105,12 @@ We could add a "ping host &&" to the front of the statement but we
have to do it in a way such that the datestamp files aren't touched.
Otherwise, when the host comes back up, it will not get the update.

Better HINFO handling:
The ability to specify two fields, or assume the first word is the first field.

Unit-testing:
It would be great if there was a directory of configurations and a
makefile that would generate all of them and compare them against
"known good" outputs.
Now that we have test/test1, it would be great if we had individual tests
for individual features. (i.e. unit tests).

Python:
I'd like to port this all the python. The code is very messy and
needs to be cleaned up. This would be a good time to rewrite it
in Python.

21 changes: 18 additions & 3 deletions bin/Example_comparezones
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
#!/bin/sh
#!/bin/bash
# Copyright 2005 Thomas A. Limoncelli
#
# 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 2 of the License, 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# Example program to show how one might compare a legacy, hand-crafted, zone
# with a newly generated zone.
# Example_comparezones -- Example program to show how one might
# compare a legacy, hand-crafted, zone with a newly generated zone.

OLD=/var/named/cibernet.com..zone
NEW=INTERNAL.cibernet.com
Expand Down
9 changes: 2 additions & 7 deletions bin/NIdhcpupdate
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#! /bin/bash


#!/bin/bash
# Copyright 2005 Thomas A. Limoncelli
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -17,6 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# NIdhcpupdate -- Update Mac OS X Server DHCP records in NetInfo.

function usage
{
Expand Down Expand Up @@ -96,7 +95,6 @@ if $DEBUG ; then
echo NIUPDATECMD=$NIUPDATECMD
fi


TEMP=/tmp
NEWHOSTS=$TEMP/nidu.new.txt
OLDHOSTS=$TEMP/nidu.cur.txt
Expand Down Expand Up @@ -129,7 +127,6 @@ awk -F'\t' <$DELLIST '
}
' | $NIUPDATECMD


# Add items:
awk -F'\t' <$ADDLIST '
NF == 3 {
Expand All @@ -138,5 +135,3 @@ awk -F'\t' <$ADDLIST '
print "merge /machines/name=" $3 " en_address " $2 ;
}
' | $NIUPDATECMD


35 changes: 15 additions & 20 deletions bin/canonzone
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/usr/bin/perl
# Copyright 2005 Thomas A. Limoncelli
#
# 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 2 of the License, 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# canonzone [domain]
# Purpose: Cannonicalize a zone file so that dumber scripts can have
Expand All @@ -20,30 +35,11 @@
# Defaults:
# If "domain" is left off the command line, we assume "bell-labs.com."

# Copyright 2005 Thomas A. Limoncelli
#
# 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 2 of the License, 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA


#
# TODO:
# Handle $GENERATE better. Include an option that expands the hosts.
#



if ($ARGV[0] =~ /-n/) {
shift @ARGV;
$nostripend = 1;
Expand Down Expand Up @@ -146,4 +142,3 @@ sub doit {

}
}

9 changes: 4 additions & 5 deletions bin/catif
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/bin/sh

# cat if the file exists
# If no files are listed, cat the empty file.

#!/bin/bash
# Copyright 2005 Thomas A. Limoncelli
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -19,6 +15,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# cat if the file exists
# If no files are listed, cat the empty file.

NONE=true

for i in $* ;
Expand Down
6 changes: 3 additions & 3 deletions bin/checkrootcache
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh

#!/bin/bash
# Copyright 2005 Thomas A. Limoncelli
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -16,10 +15,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# checkrootcache -- Check the internic's named.root file to see if there are updates.

PATH=/usr/bin:/bin:/usr/bsd
export PATH


wget -O EXTERNAL.named.root.new http://www.internic.net/zones/named.root && diff -cw EXTERNAL.named.root.new EXTERNAL.named.root

# If the original didn't exist, replace it
Expand Down
6 changes: 2 additions & 4 deletions bin/copy-if-change
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh

#!/bin/bash
# Copyright (C) 1996 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -16,8 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# This acts like "cp" but doesn't
# do anything if $1 and $2 are bit-for-bit the same.
# This acts like "cp" but doesn't do anything if $1 and $2 are bit-for-bit the same.

if
test -r $2
Expand Down
4 changes: 3 additions & 1 deletion bin/genrange
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/perl -w

# Copyright 2005 Thomas A. Limoncelli
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -16,6 +15,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# Generate a range of IP addresses. This program is useful for
# creating a template hosts.txt files.

use strict;

# Defaults and formats:
Expand Down
39 changes: 18 additions & 21 deletions bin/mergeiplists
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#!/bin/sh

#
# mergeiplist -- Print the first line to mention an IP
# address when fed a /etc/hosts-style list.
# The output is sorted by IP address.


#!/bin/bash
# Copyright 2005 Thomas A. Limoncelli
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -22,6 +15,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# mergeiplist -- Print the first line to mention an IP
# address when fed a /etc/hosts-style list.
# The output is sorted by IP address.

cat $* | perl -ne '
chomp;
if ( /^#*\s*([\d\.]+)/ ) {
Expand All @@ -45,22 +42,23 @@ cat $* | perl -ne '
# you can include an entire perl program right on the command line.
# In shell, a ' or " can start a string that continues for multiple
# lines.
# The problem is that since we use a single quote, the entire program
# can't use the single quote... unless we escape it with a backlash.
# The problem is that since we use a single quote, there can be no single
# quotes in the rest of the program... unless we escape it with a backlash.
# This makes it difficult to read, which limits this to only be usable
# for short perl programs.
# This is a better technique for awk programs, since awk rarely
# uses the single quote. (Most likely to make this technique work
# so well.)

# The perl code --- This files the first IP address on a line, and
# appends it to the start of the line followed by a "tab" then the
# The perl code --- This finds the first IP address on a line, and
# prepends it to the start of the line followed by a "tab" then the
# original line.
# If there is no IP address on the line, it prepends the entire line.
# We aren't really finding the "first IP address". We're a bit
# sloppy and just skipping over any comments, then if the next chars
# are a sequence of digits and periods we assume that's an IP address
# (no matter how long the sequence is.)
# We aren't really finding the "first IP address", just anything that
# looks similar to one. We're a bit sloppy and just skipp over any
# comments, then if the next chars are a sequence of digits and periods
# we assume that's an IP address (no matter how long the sequence
# is.)

# sort -t"\t" -u -k1,1 --- This sets the separator to TAB, uniques
# the input (removes any duplicate lines), and sets the key to be
Expand All @@ -69,13 +67,12 @@ cat $* | perl -ne '
# Note that "-u" defines "unique" as a comparison of fields being
# compared for the rest of the sort. Thus is doesn't matter if the
# rest of the line is different, only the first field is looked at
# for determining uniqueness. Many software systems have had major
# bugs because someone didn't know this. (Imagine sorting a list
# based on the third field and being surprised when half of your
# lines disappeared!)
# for determining uniqueness. I've seen major bugs as a result
# of programemrs not knowing about this feature. Here we use it
# on purpose. (Imagine sorting a list based on the third field and
# being surprised when half of your lines disappeared!)

# sortbyip --- now sort the list by IP address.

# cut -f2- --- removes the bit of info we attached to the
# front of each line.

Loading

0 comments on commit 1973335

Please sign in to comment.