summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_chk/files/pkg_chk.8
blob: 1efaa0c4e5672220c33dbb9cafd084cecbda68db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
.\"	$NetBSD: pkg_chk.8,v 1.28 2009/10/28 21:29:00 abs Exp $
.\"
.\" Copyright (c) 2001 by David Brownlee (abs@NetBSD.org)
.\" Absolutely no warranty.
.\"
.Dd May 2, 2008
.Dt PKG_CHK 8
.Sh NAME
.Nm pkg_chk
.Nd check, and optionally update, installed packages
.Sh SYNOPSIS
.Nm
.Op Fl aBbcfhiklNnpqrsuv
.Op Fl C Ar conf
.Op Fl D Ar tags
.Op Fl L Ar file
.Op Fl P Ar path
.Op Fl U Ar tags
.Sh DESCRIPTION
.Nm
verifies that the versions of installed packages matches those in
pkgsrc, optionally adding missing or updating mismatched packages.
.Pp
It can verify all installed packages, or check against a set of packages
based on the hostname, architecture, and other characteristics.
.Pp
When updating packages that depend on each other
.Nm
will skip dependent packages to reduce unnecessary rebuilding.
.Ss Options
.Bl -tag -width xxxxxxxx
.It Fl a
Automatically add any missing packages.
If a binary package exists in
.Pa ${PACKAGES}
it will be used in preference to building from source, unless the
.Fl b
or
.Fl s
options are given.
.It Fl B
Include the "Build version" (see option
.Fl b
.Xr pkg_info 1 )
of packages when determining if a package is up to date.
.It Fl b
Use binary packages.
If
.Fl s
is not set this allows
.Nm
to run without
.Ev PKGSRCDIR .
.It Fl C Ar conf
Use the
.Pa pkgchk.conf
file
.Sq Ar conf .
.It Fl D Ar tags
Add the comma separated list of tags to those checked when parsing
.Pa pkgchk.conf .
Also includes
.Ev PKGCHK_TAGS .
.It Fl f
Fetch all missing/mismatched packages found.
Can be used with
.Fl a
or
.Fl u
to perform the fetch before any building.
.It Fl g
Generate an initial
.Pa pkgchk.conf
file based upon the packages installed on the host machine.
.It Fl h
Brief help.
.It Fl k
Continue with further packages if errors are encountered.
.It Fl L Ar file
Redirect the output for all commands run into the logfile
.Pa file .
Should be specified as a full pathname.
On any error the tail end of the logfile will be displayed.
.It Fl l
List the filename for all binary packages (including best dependencies) based
on
.Pa pkgchk.conf .
Will abort if a binary package is missing.
This can be used (in conjunction with
.Fl U
and
.Fl D )
to determine what
packages would need to be copied to a remote machine to ensure it
was completely up to date.
The list is sorted so that dependencies
always come before packages which depend upon them.
.It Fl N
For each installed package, look if there is a newer version
noted in
.Pa ${PKGSRCDIR}/doc/TODO .
Good for finding packages to update.
.It Fl n
Display actions that would be taken, but do not change anything.
.It Fl P Ar path
Set the path to the binary packages.
Defaults to
.Ev PACKAGES
if
.Ev PKGSRCDIR
is available, or
.Dq Pa \&.
otherwise.
.It Fl p
Print list of package directories that will be checked, then exit.
.It Fl q
Do not display actions or take any action; only list information
about package version differences.
Useful for options that list information about package differences, such as
.Fl a
or
.Fl u .
.It Fl r
Recursively delete any mismatched packages found.
Use with care, this does not record which packages were installed
for later update.
.It Fl s
Building missing packages from source.
If UPDATE_TARGET=package is set in
.Pa /etc/mk.conf ,
then
.Nm
will automatically generate binary packages for later reuse.
.It Fl U Ar tags
Remove the comma separated list of tags from those checked when
parsing
.Pa pkgchk.conf .
Also includes
.Ev PKGCHK_NOTAGS .
Package directories can also be skipped by listing them under
.Fl U .
Passing
.Sq *
to
.Fl U
will result in all default tags being unset
.It Fl u
Automatically update any installed but out of date packages.
If a binary package exists in
.Ev PACKAGES
it will be used in preference to building from source, unless the
.Fl b
or
.Fl s
options are given.
.Pp
Note: If the update fails (particularly when building from source), the system
will be left with missing packages.
Once the error has been fixed, a second run will resume the update.
.It Fl v
Verbose - list the tags set when checking
.Pa pkgchk.conf ,
and all packages checked.
.El
.Ss Deprecated Options
.Bl -tag -width xxxxxxxx
.It Fl c
Check versions of packages specified in
.Pa pkgchk.conf .
This is a synonym for
.Nm
.Fl a q ,
and will be removed in a future version.
.It Fl i
Check versions of installed packages, ignoring
.Pa pkgchk.conf .
This is a synonym for
.Fl u q ,
and will be removed in a future version.
.El
.Sh FILE FORMAT
Anything after a
.Sq #
on a line is considered a comment.
.Pp
Each line in
.Pa pkgchk.conf
can either define a new tag or a package directory
(such as sysutils/skill), in each case followed by a list of tags.
.Ss New tag groups
Lines that define a new tag can be used to group tags to avoid
repeating the same set of tags for multiple packages.
For example:
.Dl mailserver      \= tll gta tycoon jeeves iris
would cause the mailserver tag to be set for any of the listed hosts.
Note that the tags after the
.Sq =
are parsed with the same set of tag
evaluation rules as those after package definitions (see later).
.Ss Package definition lines
Package directory lines are used to determine which packages are to be
installed, checking the tags against the current defined set.
.Ss Tag evaluation
Tags on package directory are checked against the current machine's set:
.Bl -bullet
.It
If a matched tag starts with a hyphen
.Sq - ,
the package is always excluded.
.It
Otherwise if any tags match the package will be included.
.It
A line without any tags matches all machines.
.It
An asterisk
.Sq *
matches any tag.
.It
If a tag starts with an
.Sq /
then it is checked for as a readable filename.
.It
Tags cannot contain a hyphen
.Sq -
or plus
.Sq + .
.It
Tags separated by spaces are treated as
.Dq or .
.Dq taga tagb
means if
.Em taga
or
.Em tagb
match the current machine.
.It
Tags separated by a plus are treated as
.Dq and .
.Dq taga+tagb
means if
.Em taga
and
.Em tagb
match the current machine.
.El
.Pp
The default set of tags used to determine which packages to match
in
.Pa pkgchk.conf
are equivalent to the output of the following with
any spaces converted to hyphens (-): hostname -s, hostname, uname
-srm, uname -sr, uname -sm, uname -s, uname -r, uname -m.
If
.Pa /usr/X11R6/lib/libX11.so
or
.Pa /usr/X11R6/lib/libX11.a
is present,
.Em x11
is added to the list of tags.
Tags should not contain the - or + characters.
To see tags for the current machine, run
.Nm
with the
.Fl v
option.
.Sh ENVIRONMENT
.Nm
uses the following environment variables.
.Bl -tag -width xxxx
.It Ev MAKECONF
Path to
.Pa mk.conf .
Defaults to
.Pa @MAKECONF@ , @PREFIX@/etc/mk.conf ,
or
.Pa /etc/mk.conf .
.It Ev PKGSRCDIR
Base of pkgsrc tree.
If not set in the environment, then this variable is read from
.Pa ${MAKECONF} .
If it is still not set, and if the current working directory
appears to be inside a pkgsrc tree, then this variable
is set to the base of that pkgsrc tree.
Finally, if
.Pa /usr/pkgsrc
appears to contain a pkgsrc tree, then that is used as a last resort.
.It Ev PKG_DBDIR
pkgsrc database directory.
If not set in environment then read from
.Pa ${MAKECONF} .
Defaults to
.Pa /var/db/pkg
.It Ev PACKAGES
Location of binary packages.
If not set in environment then read from
.Pa /etc/mk.conf .
Defaults to
.Pa ${PKGSRCDIR}/packages .
.Pp
Unless in a completely homogeneous environment (every machine running
exactly the same OS version and architecture) setting
.Ev ${PACKAGES}
in
.Pa /etc/mk.conf
to a value such as
.Bd -literal
${PKGSRCDIR}/packages/${LOWER_OPSYS}-${OS_VERSION}-${MACHINE_ARCH}
.Ed
.Pp
is strongly recommended.
If
.Em cpuflags
(devel/cpuflags) is being used to optimally target individual CPU types,
then
.Ev ${CPU_DIR}
should be appended to
.Ev ${PACKAGES} .
.It Ev PKGCHK_CONF
Pathname to pkg_chk configuration file.
If not set in environment then read from
.Pa /etc/mk.conf .
Defaults to
.Pa ${PKGSRCDIR}/pkgchk.conf .
.It Ev PKGCHK_UPDATE_CONF
Pathname to temporary list of installed packages used when updating.
If not set in environment then read from
.Pa /etc/mk.conf .
Defaults to
.Pa ${PKGSRCDIR}/pkgchk_update-$(hostname).conf .
Note, if pkgsrc is being
shared across multiple machines which may be updating at the same time then
it is important this file does not overlap between machines.
.It Ev PKGCHK_TAGS
Additional tags to add when parsing
.Pa pkgchk.conf .
.It Ev PKGCHK_NOTAGS
Additional tags to unset when parsing
.Pa pkgchk.conf .
.El
.Sh EXAMPLES
Sample
.Pa pkgchk.conf
file:
.Bd -literal

mailserver      = tll gta tycoon jeeves iris

# Install before others
devel/cpuflags
pkgtools/pkg_chk

# Mail related
mail/exim                       *
mail/spamassassin               mailserver
mail/cyrus-imapd                mailserver
mail/procmail                   mailserver bobhost

shells/standalone-tcsh          *
wm/pwm                          /etc/X11/XF86Config
misc/setiathome                 i386
print/acroread                  /etc/X11/XF86Config+i386
www/communicator                x11+sparc x11+sparc64
www/navigator                	x11+i386
x11/xlockmore                   x11 -wopr

.Ed
.Sh AUTHORS
.An David Brownlee
.Aq abs@NetBSD.org ,
plus much from Stoned Elipot.
.Sh BUGS
When used against binary packages,
.Nm
does not handle the directory containing multiple versions of the same package.