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
|
.\" $NetBSD: pkgchk.8,v 1.6 2001/09/27 21:13:46 abs Exp $
.\"
.\" Copyright (c) 2001 by David Brownlee (abs@netbsd.org)
.\" Absolutely no warranty.
.\"
.Dd June 28, 2001
.Dt PKGCHK 1
.Sh NAME
.Nm pkg_chk
.Nd check, and optionally update, installed packages
.Sh SYNOPSIS
.Nm
.Op Fl abchiknrsuvB
.Op Fl D Ar tags
.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.
.Pp
.Sy Options
.Bl -tag -width xxxxxxxx
.It Fl B
Check the "Build version" (see option -b of pkg_info(1)) of packages.
.It Fl D Ar tags
Add the comma separated list of tags to those checked when parsing
pkgchk.conf.
.It Fl U Ar tags
Remove the comma separated list of tags from those checked when
parsing pkgchk.conf.
.It Fl a
Automatically add any missing 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.
.It Fl b
Limit additions or updates to using binary packages. If
DEPENDS_TARGET=package
is set in
.Pa /etc/mk.conf ,
then
.Nm
will automatically generate binary packages for later reuse.
.It Fl c
Check versions of packages specified in pkgchk.conf.
.It Fl h
Brief help.
.It Fl i
Check versions of installed packages, ignoring pkgchk.conf.
.It Fl k
Continue with further packages if errors are encountered.
.It Fl n
Display actions that would be taken, but do not change anything.
.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
Limit additions or updates to building from source.
.It Fl u
Automatically update any missing packages. If a binary package exists
in 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 packaged.
.It Fl v
Verbose - list the tags set, and all packages checked.
.El
.Sh FILE FORMAT
.Pp
Each non comment line in pkgsrc.conf should contain a package
directory (such as sysutils/skill) followed by an optional list of
tags. If a tag starts with a hyphen (-), then any machine matching
will be excluded, otherwise if any tags match the current machine
the package will be included. A line with a package directory
without any tags, or the tag
.Em *
will match all machines.
.Pp
The default set of tags used to determine which packages to match in
pkgsrc.conf are equivalent to the output of the following with any spaces
converted to hypens (-): 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.
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 PKGSRCDIR
Base of pkgsrc tree. If not set in environment then read from
.Pa /etc/mk.conf .
Defaults to
.Pa /usr/pkgsrc
.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
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 .
.El
.Sh AUTHOR
David Brownlee <abs@netbsd.org>
.Sh CAVEATS
Updating packages on which other packages depend can currently only be done
via source (not binary packages).
.Pp
If both package
.Em a
and package
.Em b
are to be updated, and
.Em a
depends on
.Em b ,
.Nm
will correctly skip the update of
.Em a .
However, if
.Em a
depends on
.Em b
and
.Em c ,
and all three are marked for update,
.Nm
will update
.Em b
and
.Em c
in two separate passes, resulting in unnecessary rebuilding of
.Em a
(and potentially other packages).
|