chiark / gitweb /
keys.delete-keeper: Only do one pass through the file system.
[distorted-keys] / extract-profile.1
CommitLineData
a218eb12
MW
1.\" -*-nroff-*-
2.ie t \{\
3. ds o \(bu
4. if \n(.g .fam P
5.\}
6.el \{\
7. ds o o
8.\}
9.de hP
10.IP
11\h'-\w'\fB\\$1\ \fP'u'\fB\\$1\ \fP\c
12..
13.de VS
14.sp 1
15.RS
16.nf
17.ft B
18..
19.de VE
20.ft R
21.fi
22.RE
23.sp 1
24..
25.TH extract-profile 1 "3 May 2015" "distorted.org.uk key management"
26.SH NAME
27extract-profile \- determine configuration using inheritance and substitution
28.SH SYNOPSIS
29.B extract-profile
30.I section
31.IR file | directory ...
32.SH DESCRIPTION
33The
34.B extract-profile
35utility reads a number of
36.BR .ini -style
37configuration files from the named
38.IR file s
39and
40.IR directori es,
41combines the sections according to inheritance rules (described below),
42performs substitutions on the values,
43and writes the resulting effective contents of the named
44.I section
45to standard output.
46.PP
47A
48.I directory
49named on the command line
50causes files within to be examined:
51specifically, each file whose name consists only of
52upper- and lowercase letters,
53digits,
54underscores
55.RB (` _ '),
56and
57hyphens
58.RB (` \- ')
59will be processed;
60other files are ignored,
61as are objects in the
62.I directory
63which aren't files
64(so, in particular, directories are not processed recursively).
65The files within a directory are processed
66in ascending lexicographic order.
67It may be useful to prefix filenames with numbers
68in order to ensure that they're read in the correct order.
69.SS Command-line options
70The following options are recognized.
71.TP
72.B \-h, \-\-help
73Print an overview
74of the options and commands
75to standard output
76and exit successfully.
77.TP
78.B \-\-version
79Print the version number
80of the
81.B distorted-keys
82package
83to standard output
84and exit successfully.
85.SS Configuration data model
86A
87.I property
88has a
89.I name
90and a
91.IR value .
92A property's name must consist only of
93upper- and lowercase letters,
94digits,
95underscores
96.RB (` _ '),
97and
98percent signs
99.RB (` % ').
100A property is
101.I internal
102if its name contains
103a percent sign;
104otherwise it is
105.IR external .
106.PP
107A
108.I direct section
109has a name,
110an
111.I inclusion list
112of other sections,
113and a collection of
114.I direct properties
115with distinct names.
116.PP
117There is a special section
118named
119.B @GLOBAL
120which is implicitly included by every other section.
121.SS Configuration syntax
122Configuration files are line-oriented.
123Leading and trailing whitespace is always ignored.
124There is no line-continuation syntax.
125There are four kinds of lines.
126.hP \*o
127.IR "Blank lines" ,
128consisting only of whitespace,
129are ignored.
130.hP \*o
131.IR Comments ,
132beginning with
133hash
134.RB (` # ')
135or
136semicolon
137.RB (` ; '),
138are also ignored.
139.hP \*o
140.IR "Section headings" ,
141consisting of a name
142surrounded by square brackets
143.RB (` [ ... ] '),
144cause the following assignments,
145as far as the next section heading
146or the end of the file,
147to define or override properties in the named section.
148.hP \*o
149.IR Assignments ,
150of the form
151.I name
152.B =
153.I value
154or
155.I name
156.B :
157.IR value ,
158define (or override) direct properties
159or pseudoproperties
160in the current section.
161Spaces around the
162.RB ` = '
163or
164.RB ` : '
165are optional and, if present, ignored.
166Hyphens
167.RB (` - ')
168in the
169.I name
170are converted to
171underscores
172.RB (` _ ').
173Assignments preceding the first section header in a file
174apply to the special section
175.BR @GLOBAL .
176.PP
177The same property
178or pseudoproperty
179may be defined multiple times in a section:
180only the last definition is significant;
181earlier definitions are silently ignored.
182.PP
183Pseudoproperties have names beginning with an at sign
184.RB (` @ ').
185The following pseudoproperties are recognized.
186.TP
187.B @include
188The value is a list of section names separated by whitespace.
189The current section's inclusion list is set to
190the corresponding named sections.
191.PP
192Sections may be defined in any order.
193The same section may be defined more than once:
194the effect is the same as a single section containing
195all of the assignments of the individual sections
196in the same order.
197.SS Inheritance
198The
199.I inferiors
200of a section
201.I S
202are the sections in
203.IR S 's
204inclusion list,
205together with their inferiors.
206It is an error if a section is its own inferior.
207(Consequently, it is an error if
208.B @GLOBAL
209has a non-empty inclusion list.)
210If
211.I T
212is an inferior of
213.I S
214then
215.I S
216is a
217.I superior
218of
219.IR T .
220.PP
221A section
222.I S
223has an
224.I effective property
225named
226.I P
227if either
228.I S
229has a direct property named
230.IR P ,
231or any inferior of
232.I S
233has a direct property named
234.IR P .
235.PP
236If
237.I S
238has an effective property named
239.I P
240then
241.IR P 's
242.I defining set
243consists of those sections out of
244.I S
245and its inferiors
246which have a direct property named
247.IR P .
248The
249.I reduced defining set
250for
251.I P
252consists of those sections in the
253.I defining set
254of
255.I P
256which have no superiors in the defining set.
257.PP
258If all of the sections in the reduced defining set for
259.I P
260assign the same value to
261.I P
262then that is the
263.I effective value
264for
265.I P
266in
267.IR S ;
268otherwise the configuration is erroneous.
269.PP
270Note that,
271according to these rules,
272if
273.I S
274has a direct property
275.I P
276then
277.I S
278has an effective property
279.I P
280with the same value.
281.SS Output
282The
283.B extract-profile
284program's output consists of assignments
285.IB name = value
286for the effective properties of the named
287.IR section ,
288one per line,
289in an arbitrary order.
290.SH AUTHOR
291Mark Wooding, <mdw@distorted.org.uk>
292.SH SEE ALSO
293.BR distorted-keys (7).