X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=bin%2Fgenzone;h=0a647a985609b466ff81df62de0af6dea6204f3e;hb=dd04a4d50eca47c8ce85bf75240331bcf27367f7;hp=7805e59c728e144d2e46c114813e1d38552da414;hpb=6aca5b1015704ea66fc5fc41d05a3b88841e950f;p=nsc-5.git diff --git a/bin/genzone b/bin/genzone index 7805e59..0a647a9 100755 --- a/bin/genzone +++ b/bin/genzone @@ -13,33 +13,33 @@ Z=$1 shift CURRENT_HASH=$($M4 -DHASHING m4/nsc.m4 "$@" | md5sum | cut -d " " -f1) -if [ -f $KEYDIR/$Z.hash ] ; then - CURRENT_HASH=$CURRENT_HASH:$(cat $KEYDIR/$Z.hash) - if [ -f $KEYDIR/resign-stamp ] ; then - CURRENT_HASH=$CURRENT_HASH:$(stat -c '%Y' $KEYDIR/resign-stamp) +if [ -f keys/$Z.hash ] ; then + CURRENT_HASH=$CURRENT_HASH:$(cat keys/$Z.hash) + if [ -f keys/resign-stamp ] ; then + CURRENT_HASH=$CURRENT_HASH:$(stat -c '%Y' keys/resign-stamp) fi fi -PREV_HASH=$(if [ -s $HASHDIR/$Z ] ; then cat $HASHDIR/$Z ; fi) +PREV_HASH=$(if [ -s hash/$Z ] ; then cat hash/$Z ; fi) if [ "X$CURRENT_HASH" = "X$PREV_HASH" ] ; then echo "-- $Z: No changes" - touch $ZONEDIR/$Z $HASHDIR/$Z + touch zone/$Z hash/$Z else - $M4 -DVERS=$VERSDIR/$Z m4/nsc.m4 "$@" >$ZONEDIR/$Z.new - NEWVER="$(sed -e "s/^;;; VERSION: //; t; d" $ZONEDIR/$Z.new)" - if [ -f $KEYDIR/$Z.hash ] ; then - if ! dnssec-signzone -a -d $DSSDIR -g -K $KEYDIR/$Z $SIGNZONE_OPTIONS -f $ZONEDIR/$Z.signed -o $Z -S -3 - $ZONEDIR/$Z.new &>$ZONEDIR/$Z.tmp ; then - cat $ZONEDIR/$Z.tmp + $M4 -DVERS=ver/$Z m4/nsc.m4 "$@" >zone/$Z.new + NEWVER="$(sed -e "s/^;;; VERSION: //; t; d" zone/$Z.new)" + if [ -f keys/$Z.hash ] ; then + if ! dnssec-signzone -a -d dss -g -K keys/$Z $SIGNZONE_OPTIONS -f zone/$Z.signed -o $Z -S -3 - zone/$Z.new &>zone/$Z.tmp ; then + cat zone/$Z.tmp echo >&2 "FATAL: Signing failed" exit 1 fi - rm -f $ZONEDIR/$Z.tmp - mv $ZONEDIR/$Z.signed $ZONEDIR/$Z + rm -f zone/$Z.tmp + mv zone/$Z.signed zone/$Z SIGNED=" (signed)" else - mv $ZONEDIR/$Z.new $ZONEDIR/$Z + mv zone/$Z.new zone/$Z SIGNED= fi echo "** $Z: New version $NEWVER$SIGNED" - echo $CURRENT_HASH >$HASHDIR/$Z + echo $CURRENT_HASH >hash/$Z fi