#!/bin/sh

# 
# this script looks for a TXT resource record at a given name
# It does so using lwdnsq in HEAD
# and  
# with dig in 2.xx
#
# arg #1 is name
# arg #2 is public key fragment to look for

item=$1 shift
partof=$1 shift

# seems to prime bind
dig $item txt >/dev/null

if [ -f "/usr/local/libexec/ipsec/lwdnsq" ]
then
echo "txt 12334 $item" | ipsec lwdnsq --regress --serial --ignoreeof >/tmp/looktxt
else
dig $item txt >/tmp/looktxt
fi

if fgrep "$partof" /tmp/looktxt >/dev/null
then
	echo LOOK-FOR-TXT FOUND $partof
else
	echo LOOK-FOR-TXT DID NOT FIND $partof
fi
