6 # v1.0 B. Galliart (designed to work with 2.3 inn.conf man page)
7 # v1.1 B. Galliart (optional support for using inn.conf POD src instead)
10 # This script is written to inner-mix the inn.conf settings with the
11 # documentation from the inn.conf man page. The concept was shamelessly
12 # ripped off of a CGI application provided at Mib Software's Usenet Rapid
13 # Knowledge Transfer (http://www.mibsoftware.com/userkt/inn2.0/).
15 # The idea is that a news administrator usually must go through the
16 # task of reading the inn.conf man page in parallel with the inn.conf
17 # inn.conf to confirm that the settings are set as desired. Manually
18 # matching up the two files can become troublesome. This script should
19 # make the task easier and hopefully reduce the chance a misconfiguration
23 # - Is very dependent on the format of the man page. It is know NOT to
24 # work with the inn.conf man pages written before INN 2.3 and may
25 # require minor rewriting to address future revisions of inn.conf
26 # Note: this known bug is addressed via the "EDITPOD" option below
27 # but is not enabled by default (details explained below).
29 # - SECURITY! While taken from the concept of a CGI script, it is not
30 # intended to be a CGI script itself. It is *assumed* that the
31 # inn.conf file is provided by a "trusted" source.
33 ### License: this script is provided under the same terms as the majority
34 # of INN 2.3.0 as stated in the file "inn-2.3.0/LICENSE"
36 ### Warrenty/Disclaimer: There is no warrenty provided. For details, please
37 # refer to the file "inn-2.3.0/LICENSE" from the INN 2.3 package
41 ### The User Modifiable Parameters/Settings:
43 # INNCONF should be set to the actual location of the inn.conf file
44 INNCONF=/usr/local/news/etc/inn.conf
46 # INNCONFMAN should be set to the location of the inn.conf man page
47 INNCONFMAN=/usr/local/news/man/man5/inn.conf.5
49 # INNCONFPOD should be set to the location of the inn.conf POD source
50 # INNCONFPOD=/usr/local/src/inn-2.3.0/doc/pod/inn.conf.pod
51 INNCONFPOD=/usr/local/news/man/man5/inn.conf.pod
53 # NROFF should be set to an approbate program for formating the man page
54 # this could be the vendor provided nroff, the FSF's groff (which could be
55 # used for producing PostScript output) or Earl Hood's man2html from
56 # http://www.oac.uci.edu/indiv/ehood/man2html.html
61 # Pager should be set to an approbate binary for making the output
62 # readable in the user's desired method. Possible settings include
63 # page, more, less, ghostview, lynx, mozilla, lpr, etc. If no pager
64 # application is desire then by setting it to "cat" will cause the output
65 # to continue on to stdout.
68 # By default the script uses the inn.conf man page before being processed
69 # by nroff to edit in the actual inn.conf settings. The problem with this
70 # approach is that if the format of the inn.conf man page ever changes
71 # assumptions about the format that this script makes will probably break.
72 # Presently, the base/orginal format of the inn.conf man page is in perl
73 # POD documentation. The formating of this file is less likely to change
74 # in the future and is a cleaner format for automated editing. However,
75 # their is some disadvantages to using this file. First disadvantage,
76 # the POD file is not installed by INN 2.3.0 by default (see INNCONFPOD
77 # enviromental variable for setting the script to find the file in the
78 # correct location). Second disadvantage, pod2man does not appear to
79 # support using stdin so the edited POD must be temporarily stored as a
80 # file. Finally, the last disadvantage, the script is slower due to the
81 # added processing time of pod2man. Weighing the advantages and
82 # disadvantages to both approaches are left to the user. If you wish to
83 # have innconfcheck edit the POD file then change the variable below to
84 # a setting of "1", otherwise leave it with the setting of "0"
89 ### The Script: (non-developers should not need to go beyond this point)
91 # All variable settings in inn.conf should not contain a comment
92 # character of "#" and should have a ":" in the line. These variable names
93 # should then be matched up with the man page "items" in the inn.conf file.
94 # In the INN 2.3 man page, these items appear in the following format:
95 # .Ip "\fIvariable name\fR" 4
96 # Hence, if there exists an entry in the inn.conf of "verifycancels: false"
97 # then the awk script will produce:
98 # s#^.Ip "\fIvarifycancels\f$" 4#.Ip "\verifycancels: false\f$" 4#
99 # once piped to sed, this expression will replace the man page item to
100 # include the setting from the inn.conf file. The nroff and pager
101 # applications then polish the script off to provide a documented formated
102 # in a way that is easier to find incorrect setting withen.
104 if [ $EDITPOD -eq 0 ] ; then
106 grep -v "#" $INNCONF | grep ":" | \
107 awk 'BEGIN { FS = ":" } { print "s#^.Ip \042\\\\fI"$1"\\\\fR\042 4#.Ip \042\\\\fI"$0"\\\\fR\042 4#" }' | \
108 sed -f - $INNCONFMAN | $NROFF | $PAGER
112 # The next part is similar to above but provides working from the POD source
113 # instead of from the resulting nroff/man page. This section is discussed
114 # in more detail above with the "EDITPOD" setting.
116 grep -v "#" $INNCONF | grep ":" | \
117 awk 'BEGIN { FS = ":" } { print "s#=item I<"$1">#=item I<"$0">#" }' | \
118 sed -f - $INNCONFPOD > /tmp/innconfcheck-$$
119 pod2man /tmp/innconfcheck-$$ | $NROFF | $PAGER
120 rm -f /tmp/innconfcheck-$$