Traiano Welcome
2010-07-24 09:50:46 UTC
Hi List
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone file before it's
committed. To do this, I have a shell wrapper that takes the name of the
zone file as an argument and formats a command for the syntax checker. The
shell wrapper is called from the commitinfo file as follows:
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone file when any
file under " named.data/ZONES/" is committed. The checkzone script is as
follows:
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f 2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file, consequently the
shell script does not get the correct argument and the commit fails:
---
[***@box ~/named.data/ZONES]$ cvs commit DB.evasive.co.za
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me? I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone file before it's
committed. To do this, I have a shell wrapper that takes the name of the
zone file as an argument and formats a command for the syntax checker. The
shell wrapper is called from the commitinfo file as follows:
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone file when any
file under " named.data/ZONES/" is committed. The checkzone script is as
follows:
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f 2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file, consequently the
shell script does not get the correct argument and the commit fails:
---
[***@box ~/named.data/ZONES]$ cvs commit DB.evasive.co.za
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me? I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.