xref: /netbsd-src/external/bsd/pkg_install/dist/create/pkg_create.1 (revision f46918ca2125b9b1e7ca5a22c07d1414c618e467)
1.\" $NetBSD: pkg_create.1,v 1.4 2021/04/10 19:49:59 nia Exp $
2.\"
3.\" FreeBSD install - a package for the installation and maintenance
4.\" of non-core utilities.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" Jordan K. Hubbard
16.\"
17.\"
18.\"     @(#)pkg_create.1
19.\"	from FreeBSD Id: pkg_create.1,v 1.19 1997/05/02 22:00:05 max Exp
20.\"
21.\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords,
22.\" added dependency tracking, etc.
23.\"
24.\" [jkh] Took John's changes back and made some additional extensions for
25.\" better integration with FreeBSD's new ports collection.
26.\"
27.Dd December 27, 2014
28.Dt PKG_CREATE 1
29.Os
30.Sh NAME
31.Nm pkg_create
32.Nd a utility for creating software package distributions
33.Sh SYNOPSIS
34.Nm
35.Op Fl lOVv
36.Op Fl B Ar build-info-file
37.Op Fl b Ar build-version-file
38.Op Fl C Ar cpkgs
39.Op Fl D Ar displayfile
40.Op Fl F Ar compression
41.Op Fl g Ar group
42.Op Fl I Ar realprefix
43.Op Fl i Ar iscript
44.Op Fl K Ar pkg_dbdir
45.Op Fl k Ar dscript
46.Op Fl n Ar preserve-file
47.Op Fl P Ar dpkgs
48.Op Fl p Ar prefix
49.Op Fl S Ar size-all-file
50.Op Fl s Ar size-pkg-file
51.Op Fl T Ar buildpkgs
52.Op Fl t Ar template
53.Op Fl u Ar owner
54.Fl c Ar comment
55.Fl d Ar description
56.Fl f Ar packlist
57.Ar pkg-name
58.Sh DESCRIPTION
59The
60.Nm
61command is used to create packages that will subsequently be fed to
62one of the package extraction/info utilities.
63The input description and command line arguments for the creation of a
64package are not really meant to be human-generated, though it is easy
65enough to do so.
66It is more expected that you will use a front-end tool for
67the job rather than muddling through it yourself.
68Nonetheless, a short description of the input syntax is included in this
69document.
70.Sh OPTIONS
71The following command line options are supported:
72.Bl -tag -width indent
73.It Fl B Ar build-info-file
74Install the file
75.Ar build-info-file
76so that users of binary packages can see what
77.Xr make 1
78definitions
79were used to control the build when creating the
80binary package.
81This allows various build definitions to be retained in a binary package
82and viewed wherever it is installed, using
83.Xr pkg_info 1 .
84.It Fl b Ar build-version-file
85Install the file
86.Ar build-version-file
87so that users of binary packages can see what versions of
88the files used to control the build were used when creating the
89binary package.
90This allows some fine-grained version control information to be retained
91in a binary package and viewed wherever it is installed, using
92.Xr pkg_info 1 .
93.It Fl C Ar cpkgs
94Set the initial package conflict list to
95.Ar cpkgs .
96This is assumed to be a whitespace separated list of package names
97and is meant as a convenient shorthand for specifying multiple
98.Cm @pkgcfl
99directives in the packing list (see PACKING LIST DETAILS section below).
100.It Fl c Ar [-]desc
101Fetch package
102.Pq one line description
103from file
104.Ar desc
105or, if preceded by
106.Cm - ,
107the argument itself.
108This string should also give some idea of which version of the product
109(if any) the package represents.
110.It Fl D Ar displayfile
111Display the file after installing the package.
112Useful for things like legal notices on almost-free software, etc.
113.It Fl d Ar [-]desc
114Fetch long description for package from file
115.Ar desc
116or, if preceded by
117.Cm - ,
118the argument itself.
119.It Fl F Ar compression
120Use
121.Ar compression
122as compression algorithm.
123This overrides the heuristic to guess the compression type from the
124output name.
125Currently supported values are bzip2, gzip, none and xz.
126.It Fl f Ar packlist
127Fetch
128.Pq packing list
129for package from the file
130.Ar packlist
131or
132.Cm stdin
133if
134.Ar packlist
135is a
136.Cm -
137(dash).
138.It Fl g Ar group
139Make
140.Ar group
141the default group ownership instead of extracting it from the file system.
142.It Fl I Ar realprefix
143Provide the real prefix, as opposed to the staging prefix, for use in
144staged installations of packages.
145.It Fl i Ar iscript
146Set
147.Ar iscript
148to be the install procedure for the package.
149This can be any executable program (or shell script).
150It will be invoked automatically when the package is later installed.
151.It Fl K Ar pkg_dbdir
152Override the value of the
153.Dv PKG_DBDIR
154configuration option with the value
155.Ar pkg_dbdir .
156.It Fl k Ar dscript
157Set
158.Ar dscript
159to be the de-install procedure for the package.
160This can be any executable program (or shell script).
161It will be invoked automatically
162when the package is later (if ever) de-installed.
163.It Fl l
164Check that any symbolic links which are to be placed in the package are
165relative to the current prefix.
166This means using
167.Xr unlink 2
168and
169.Xr symlink 2
170to remove and re-link
171any symbolic links which are targeted at full path names.
172.It Fl n Ar preserve-file
173The file is used to denote that the package should not be deleted.
174This is intended for use where the deletion of packages may present
175a bootstrap problem.
176.It Fl O
177Go into a
178.Pq packing list only
179mode.
180This is used to do
181.Pq fake pkg_add
182operations when a package is installed.
183In such cases, it is necessary to know what the final, adjusted packing
184list will look like.
185.It Fl P Ar dpkgs
186Set the initial package dependency list to
187.Ar dpkgs .
188This is assumed to be a whitespace separated list of package names
189and is meant as a convenient shorthand for specifying multiple
190.Cm @pkgdep
191directives in the packing list (see PACKING LIST DETAILS section below).
192In addition, the exact versions of the packages referred to in the
193.Ar dpkgs
194list will be added to the packing list in the form of
195.Cm @blddep
196directives.
197.It Fl T Ar buildpkgs
198The exact versions of the packages referred to in the
199.Ar buildpkgs
200list will be added to the packing list in the form of
201.Cm @blddep
202directives.
203This directives are stored after those created by the
204.Fl P
205option.
206.Ar buildpkgs
207is assumed to be a whitespace separated list of package names.
208.It Fl p Ar prefix
209Set
210.Ar prefix
211as the initial directory
212.Pq base
213to start from in selecting files for
214the package.
215.It Fl S Ar size-all-file
216Store the given file for later querying with the
217.Xr pkg_info 1
218.Fl S
219flag.
220The file is expected to contain the size (in bytes) of all files of
221this package plus any required packages added up and stored as a
222ASCII string, terminated by a newline.
223.It Fl s Ar size-pkg-file
224Store the given file for later querying with the
225.Xr pkg_info 1
226.Fl s
227flag.
228The file is expected to contain the size (in bytes) of all files of
229this package added up and stored as a ASCII string, terminated by a newline.
230.It Fl t Ar template
231Use
232.Ar template
233as the input to
234.Xr mktemp 3 .
235By default, this is the string
236.Pa /tmp/instmp.XXXXXX ,
237but it may be necessary to override it in the situation where
238space in your
239.Pa /tmp
240directory is limited.
241Be sure to leave some number of
242.Sq X
243characters for
244.Xr mktemp 3
245to fill in with a unique ID.
246.It Fl u Ar owner
247Make
248.Ar owner
249the default owner instead of extracting it from the file system.
250.It Fl V
251Print version number and exit.
252.It Fl v
253Turn on verbose output.
254.El
255.Sh PACKING LIST DETAILS
256The
257.Pq packing list
258format (see
259.Fl f )
260is fairly simple, being
261nothing more than a single column of filenames to include in the
262package.
263However, since absolute pathnames are generally a bad idea
264for a package that could be installed potentially anywhere, there is
265another method of specifying where things are supposed to go
266and, optionally, what ownership and mode information they should be
267installed with.
268This is done by embedding specialized command sequences
269in the packing list.
270Briefly described, these sequences are:
271.Bl -tag -width indent -compact
272.It Cm @cwd Ar directory
273Set the internal directory pointer to point to
274.Ar directory .
275All subsequent filenames will be assumed relative to this directory.
276Note:
277.Cm @cd
278is also an alias for this command.
279.It Cm @src Ar directory
280This command is supported for compatibility only.
281It was formerly used to override
282.Cm @cwd
283during package creation.
284.It Cm @exec Ar command
285Execute
286.Ar command
287as part of the unpacking process.
288If
289.Ar command
290contains any of the following sequences somewhere in it, they will
291be expanded inline.
292For the following examples, assume that
293.Cm @cwd
294is set to
295.Pa /usr/local
296and the last extracted file was
297.Pa bin/emacs .
298.Bl -tag -width indent -compact
299.It Cm "\&%F"
300Expands to the last filename extracted (as specified), in the example case
301.Pa bin/emacs
302.It Cm "\&%D"
303Expand to the current directory prefix, as set with
304.Cm @cwd ,
305in the example case
306.Pa /usr/local .
307.It Cm "\&%B"
308Expand to the
309.Pq basename
310of the fully qualified filename, that
311is the current directory prefix, plus the last filespec, minus
312the trailing filename.
313In the example case, that would be
314.Pa /usr/local/bin .
315.It Cm "\&%f"
316Expand to the
317.Pq filename
318part of the fully qualified name, or
319the converse of
320.Cm \&%B ,
321being in the example case,
322.Pa emacs .
323.El
324.It Cm @unexec Ar command
325Execute
326.Ar command
327as part of the deinstallation process.
328Expansion of special
329.Cm \&%
330sequences is the same as for
331.Cm @exec .
332This command is not executed during the package add, as
333.Cm @exec
334is, but rather when the package is deleted.
335This is useful for deleting links and other ancillary files that were created
336as a result of adding the package, but not directly known to the package's
337table of contents (and hence not automatically removable).
338The advantage of using
339.Cm @unexec
340over a deinstallation script is that you can use the
341.Pq special sequence expansion
342to get at files regardless of where they've
343been potentially redirected (see
344.Fl p ) .
345.It Cm @mode Ar mode
346Set default permission for all subsequently extracted files to
347.Ar mode .
348Format is the same as that used by the
349.Cm chmod
350command (well, considering that it's later handed off to it, that's
351no surprise).
352Use without an arg to set back to default (extraction) permissions.
353.It Cm @option Ar option
354Set internal package options, the only currently supported one
355being
356.Ar preserve ,
357which tells pkg_add to move any existing files out of the way,
358preserving the previous contents (which are also resurrected on
359pkg_delete, so caveat emptor).
360.It Cm @owner Ar user
361Set default ownership for all subsequently extracted files to
362.Ar user .
363Use without an arg to set back to default (extraction)
364ownership.
365.It Cm @group Ar group
366Set default group ownership for all subsequently extracted files to
367.Ar group .
368Use without an arg to set back to default (extraction)
369group ownership.
370.It Cm @comment Ar string
371Embed a comment in the packing list.
372Useful in trying to document some particularly hairy sequence that
373may trip someone up later.
374.It Cm @ignore
375Used internally to tell extraction to ignore the next file (don't
376copy it anywhere), as it's used for some special purpose.
377.It Cm @name Ar name
378Set the name of the package.
379This is mandatory and is usually put at the top.
380This name is potentially different than the name of the file it came in,
381and is used when keeping track of the package for later deinstallation.
382Note that
383.Nm
384will derive this field from the
385.Ar pkg-name
386and add it automatically if none is given.
387.It Cm @pkgdir Ar name
388Declare directory
389.Pa name
390as managed.
391If it does not exist at installation time, it is created.
392If this directory is no longer referenced by packages and the last
393file or directory in it is deleted, the directory is removed as well.
394.It Cm @dirrm Ar name
395This command is supported for compatibility only.
396If directory
397.Pa name
398exists, it will be deleted at deinstall time.
399.It Cm @display Ar name
400Declare
401.Pa name
402as the file to be displayed at install time (see
403.Fl D
404above).
405.It Cm @pkgdep Ar pkgname
406Declare a dependency on the
407.Ar pkgname
408package.
409The
410.Ar pkgname
411package must be installed before this package may be
412installed, and this package must be deinstalled before the
413.Ar pkgname
414package is deinstalled.
415Multiple
416.Cm @pkgdep
417directives may be used if the package depends on multiple other packages.
418.It Cm @blddep Ar pkgname
419Declare that this package was built with the exact version
420of
421.Ar pkgname
422(since the
423.Cm @pkgdep
424directive may contain wildcards or relational
425package version information).
426.It Cm @pkgcfl Ar pkgcflname
427Declare a conflict with the
428.Ar pkgcflname
429package, as the two packages contain references to the same files,
430and so cannot co-exist on the same system.
431.El
432.Sh ENVIRONMENT
433See
434.Xr pkg_install.conf 5
435for options, that can also be specified using the environment.
436.Sh SEE ALSO
437.Xr pkg_add 1 ,
438.Xr pkg_admin 1 ,
439.Xr pkg_delete 1 ,
440.Xr pkg_info 1 ,
441.Xr pkg_install.conf 5
442.Xr pkgsrc 7
443.Sh HISTORY
444The
445.Nm
446command first appeared in
447.Fx .
448.Sh AUTHORS
449.Bl -tag -width indent -compact
450.It Jordan Hubbard
451most of the work
452.It John Kohl
453refined it for
454.Nx
455.It Hubert Feyrer
456.Nx
457wildcard dependency processing, pkgdb, pkg size recording etc.
458.El
459