forked from freebsd/pkg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkg-create.8
528 lines (527 loc) · 13.9 KB
/
pkg-create.8
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
.\"
.\" FreeBSD pkg - a next generation package for the installation and maintenance
.\" of non-core utilities.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\"
.\" @(#)pkg.8
.\"
.Dd September 26, 2015
.Dt PKG-CREATE 8
.Os
.\" ---------------------------------------------------------------------------
.Sh NAME
.Nm "pkg create"
.Nd a utility for creating software package distributions
.\" ---------------------------------------------------------------------------
.Sh SYNOPSIS
.Nm
.Op Fl nqv
.Op Fl f Ar format
.Op Fl o Ar outdir
.Op Fl p Ar plist
.Op Fl r Ar rootdir
.Fl m Ar metadatadir
.Nm
.Op Fl nqv
.Op Fl f Ar format
.Op Fl o Ar outdir
.Op Fl r Ar rootdir
.Fl M Ar manifest
.Nm
.Op Fl gnqvx
.Op Fl f Ar format
.Op Fl o Ar outdir
.Op Fl r Ar rootdir
.Ar pkg-name ...
.Nm
.Op Fl nqv
.Op Fl f Ar format
.Op Fl o Ar outdir
.Op Fl r Ar rootdir
.Fl a
.\" ---------------------------------------------------------------------------
.Pp
.Nm
.Op Cm --no-clobber
.Op Cm --quiet
.Op Cm --verbose
.Op Cm --format Ar format
.Op Cm --out-dir Ar outdir
.Op Cm --plist Ar plist
.Op Cm --root-dir Ar rootdir
.Cm --metadata Ar metadatadir
.Nm
.Op Cm --no-clobber
.Op Cm --quiet
.Op Cm --verbose
.Op Cm --format Ar format
.Op Cm --out-dir Ar outdir
.Op Cm --root-dir Ar rootdir
.Cm --manifest Ar manifest
.Nm
.Op Cm --{glob,no-clobber,regex}
.Op Cm --quiet
.Op Cm --verbose
.Op Cm --format Ar format
.Op Cm --out-dir Ar outdir
.Op Cm --root-dir Ar rootdir
.Ar pkg-name ...
.Nm
.Op Cm --no-clobber
.Op Cm --quiet
.Op Cm --verbose
.Op Cm --format Ar format
.Op Cm --out-dir Ar outdir
.Op Cm --root-dir Ar rootdir
.Cm --all
.\" ---------------------------------------------------------------------------
.Sh DESCRIPTION
.Nm
is used to create packages from binaries or other files installed on
your computer.
Package tarballs can be created from the files of a previously installed
package using metadata from the local package database.
Any number of packages may be created in one invocation of this style.
.Pp
Alternatively, a single package can be created from an arbitrary
selection of files on your system, but this requires a
.Ar metadatadir
and optionally
.Ar plist
to be supplied.
The package name will be derived from the
.Pa +MANIFEST
file which must be contained within the
.Ar metadatadir ,
or passed as the argument to
.Fl M .
.Pp
Packages thus created can be distributed and subsequently installed on
other machines using the
.Cm pkg add
command.
.\" ---------------------------------------------------------------------------
.Sh OPTIONS
The following options are supported by
.Nm :
.Bl -tag -width ".Fl m Ar metadatadir"
.It Fl a , Cm --all
Create package tarballs from all packages installed on your system.
This option is incompatible with the
.Fl g , x
or
.Fl m Ar metadatadir
options.
.It Fl g , Cm --glob
Interpret
.Ar pkg-name
as a shell glob pattern and create package only for installed binaries whose
name match this pattern.
This option is incompatible with the
.Fl a , x
or
.Fl m Ar metadatadir
options.
.It Fl x , Cm --regex
Like
.Fl g ,
but interpret
.Ar pkg-name
as a regular expression using the "modern" or "extended" syntax described in
.Xr re_format 7 .
This option is incompatible with the
.Fl a, g
or
.Fl m Ar metadatadir
options.
.It Fl f Ar format , Cm --format Ar format
Set
.Ar format
as the package output format.
It can be one of
.Ar txz , tbz , tgz
or
.Ar tar
which are currently the only supported formats.
If an invalid or no format is specified
.Ar txz
is assumed.
.It Fl m Ar metadatadir , Cm --metadata Ar metadatadir
Specify the directory containing the package manifest,
.Pa +MANIFEST
and optionally three other files; one containing a message to be
displayed on package installation,
.Pa +DISPLAY .
Another containing the description for the package,
.Pa +DESC .
If specified, only a single package will be created.
.Pa +DISPLAY
and
.Pa +DESC
are not required; the
.Pa +MANIFEST
file can contain all the required information needed to build a
package.
This option is incompatible with the
.Fl M, a, g
or
.Fl x
options.
.It Fl M Ar manifest , Cm --manifest Ar manifest
Read all of the package metadata from the
.Ar manifest
file.
This is exactly the same format as
.Pa +MANIFEST
mentioned above, but any file name can be used, and no
other file will be used to read package metadata from.
If specified, only a single package will be created.
This option is incompatible with the
.Fl m, a, g
or
.Fl x
options.
.It Fl n , Cm --no-clobber
Do not overwrite already existing packages.
.It Fl o Ar outdir , Cm --out-dir Ar outdir
Set
.Ar outdir
as the output directory.
If this option is not given, all created packages will
be saved in the current directory.
.It Fl p Ar plist , Cm --plist Ar plist
Specify some package metadata using the legacy plist format from
.Xr pkg_add 1 ,
commonly found in
.Pa pkg-plist
files in the ports tree.
Metadata from the
.Ar plist
file, if specified, will take precedence over any equivalents from
the
.Ar metadatadir .
Only has any effect when used with
.Ar metadatadir .
See
.Sx "PLIST FORMAT"
for details.
.It Fl q , Cm --quiet
Force quiet output.
This is the default, unless
.Cm PKG_CREATE_VERBOSE
is set to
.Ar yes
in
.Pa pkg.conf .
.It Fl v , Cm --verbose
Force verbose output, the opposite of
.Cm --quiet .
.It Fl r Ar rootdir , Cm --root-dir Ar rootdir
.Ar rootdir
specifies the top-level directory to be treated as the root of the
filesystem hierarchy containing the package files.
File paths in generated packages will be relative to
.Ar rootdir .
This allows a package to be generated from content offset from its
intended final location, which allows a package building without
disturbing similar content already on the system.
If unspecified, the default is effectively
.Pa / ,
the actual root directory.
.El
.\" ---------------------------------------------------------------------------
.Sh MANIFEST FILE DETAILS
.Bl -tag -width ".Cm www"
.It Cm name Ar pkg-name
This entry sets the package's name to
.Ar pkg-name . \" TODO: Find out why there is a space after the ``.''
Among other things, this name is used - with the version and the origin of the
concerned package - to identify a dependency.
.It Cm version Ar pkg-version
This entry sets the package's version to
.Ar pkg-version .
.It Cm origin Ar pkg-origin
This entry sets the package's origin to
.Ar pkg-origin .
This is a string of the form
.Pa category/port-dir
which designates the port this package was built from.
.It Cm comment Ar comment-string
.Ar comment-string
is a one-line description of this package.
It is the equivalent of the
.Dv COMMENT
variable for a port, not a way to put comments in a
.Pa +MANIFEST
file.
.It Cm desc Ar description
.Ar description
is a longer description of the package.
It is the equivalent of the
.Pa pkg-descr
file for a port.
It may be one to a few paragraphs.
For example:
.Bd -literal -offset indent
desc = <<EOD
This is a longer description of the package.
It can span multiple lines.
It can also span multiple paragraphs.
EOD
.Ed
.It Cm arch Ar cpu-type
The architecture of the machine the package was built on.
.Ar cpu-type
takes values like x86, amd64...
.It Cm www Ar url
The software's official website.
.It Cm maintainer Ar mail-address
The maintainer's mail address.
.It Cm prefix Ar path-prefix
The path where the files contained in this package are installed
.Pq usually Pa /usr/local .
.It Cm flatsize Ar size
The size that the files contained in this package will occupy on your system
once uncompressed.
This value does not take into account files stored in the
package database.
.It Cm deps Ar dep-name dep-origin dep-version
Associative array of package dependencies, keyed on
.Ar dep-name
and with values
.Cm version Ar dep-version
and
.Cm origin Ar dep-origin .
For example:
.Bd -literal -offset indent
"deps" : {
"pstree" : {
"version" : "2.36",
"origin" : "sysutils/pstree"
},
"cdiff" : {
"version" : "0.9.6.20140711,1",
"origin" : "textproc/cdiff"
},
},
.Ed
.It Cm conflict Ar pkg-glob
Flag this package as incompatible with the one designated by
.Ar pkg-glob .
Conflicting packages cannot be installed on the same system as they may contain
references to the sames files.
.It Cm option Ar option-name option-value
Set the option
.Ar option-name
to the value
.Ar option-value .
.It Cm file Ar sha256-hash path
.Cm file
entries list files included in the package.
If the file is a regular one, such
an entry contains its sha256 digest along with its path.
If a packaged file is
a link, you must use this entry's other form, as described below.
.It Cm file Ar - path
Same as above but for file links.
The sha256 hash is replaced with a
.Ar -
(dash).
.It Cm dir Ar path
Mimics the
.Cm file
entry but for directories.
.El
.Sh PLIST FORMAT
The following describes the plist format:
.Pp
The plist is a sequential list of lines which can have keywords prepended.
A keyword starts with an
.Sq @ .
Lines not starting with a keyword are considered as paths to a file.
If started with a
.Sq /
then it is considered an absolute path.
Otherwise the file is considered as relative to
.Ev PREFIX .
.Pp
Keyword lines are formed as follows:
.Ar @keyword
.Ar line
.Pp
Available keywords are the following:
.Pp
.Bl -tag -width indent -compact
.It Cm @cwd Op Ar directory
Set the internal directory pointer to point to
.Ar directory .
All subsequent filenames will be assumed relative to this directory.
.It Cm @preexec Ar Command
Execute
.Ar command
as part of the pre-install scripts.
.It Cm @preunexec Ar command
Execute
.Ar command
as part of the pre-deinstall scripts.
.It Cm @postexec Ar command
Execute
.Ar command
as part of the post-install scripts.
.It Cm @postunexec Ar command
Execute
.Ar command
as part of the post-deinstall scripts.
.It Cm @exec Ar command Pq deprecated
Execute
.Ar command
as part of the unpacking process.
If
.Ar command
contains any of the following sequences somewhere in it, they will
be expanded inline.
For the following examples, assume that
.Cm @cwd
is set to
.Pa /usr/local
and the last extracted file was
.Pa bin/emacs .
.Bl -tag -width indent -compact
.It Cm "%F"
Expands to the last filename extracted (as specified), in the example case
.Pa bin/emacs
.It Cm "\&%D"
Expand to the current directory prefix, as set with
.Cm @cwd ,
in the example case
.Pa /usr/local .
.It Cm "\&%B"
Expand to the
.Dq basename
of the fully qualified filename, that is the current directory prefix,
plus the last filespec, minus the trailing filename.
In the example case, that would be
.Pa /usr/local/bin .
.It Cm "%f"
Expand to the filename part of the fully qualified name, or
the converse of
.Cm \&%B ,
being in the example case,
.Pa emacs .
.El
.It Cm @unexec Ar command Pq deprecated
Execute
.Ar command
as part of the deinstallation process.
Expansion of special
.Cm %
sequences is the same as for
.Cm @exec .
This command is not executed during the package add, as
.Cm @exec
is, but rather when the package is deleted.
This is useful for deleting links and other ancillary files that were
created as a result of adding the package, but not directly known to
the package's table of contents (and hence not automatically
removable).
.It Cm @mode Ar mode
Set default permission for all subsequently extracted files to
.Ar mode .
Format is the same as that used by the
.Cm chmod
command.
Use without an arg to set back to default (mode of the file while being packed)
permissions.
.It Cm @owner Ar user
Set default ownership for all subsequent files to
.Ar user .
Use without an arg to set back to default (root)
ownership.
.It Cm @group Ar group
Set default group ownership for all subsequent files to
.Ar group .
Use without an arg to set back to default (wheel)
group ownership.
.It Cm @comment Ar string
The line will be ignored when packing.
.It Cm @dir Ar name
Declare directory
.Pa name
to be deleted at deinstall time.
By default, most directories created by a package installation are
deleted automatically when the package is deinstalled, so this directive is
only needed for empty directories or directories outside of
.Ev PREFIX .
These directives should appear at the end of the package list.
If the directory is not empty a warning will be printed, and the
directory will not be removed.
(Subdirectories should be listed before parent directories.)
.El
.\" ---------------------------------------------------------------------------
.Sh ENVIRONMENT
The following environment variables affect the execution of
.Nm .
See
.Xr pkg.conf 5
for further description.
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
.It Ev PKG_DBDIR
.It Ev PLIST_KEYWORDS_DIR
.It Ev PORTSDIR
.El
.\" ---------------------------------------------------------------------------
.Sh FILES
See
.Xr pkg.conf 5 .
.\" ---------------------------------------------------------------------------
.Sh EXAMPLES
Create package files for installed packages:
.Dl % pkg create -a -o /usr/ports/packages/All
.Pp
Create package file for pkg:
.Dl % pkg create -o /usr/ports/packages/All pkg
.\" ---------------------------------------------------------------------------
.Sh SEE ALSO
.Xr pkg_printf 3 ,
.Xr pkg_repos 3 ,
.Xr pkg-repository 5 ,
.Xr pkg.conf 5 ,
.Xr pkg 8 ,
.Xr pkg-add 8 ,
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
.Xr pkg-delete 8 ,
.Xr pkg-fetch 8 ,
.Xr pkg-info 8 ,
.Xr pkg-install 8 ,
.Xr pkg-lock 8 ,
.Xr pkg-query 8 ,
.Xr pkg-register 8 ,
.Xr pkg-repo 8 ,
.Xr pkg-rquery 8 ,
.Xr pkg-search 8 ,
.Xr pkg-set 8 ,
.Xr pkg-shell 8 ,
.Xr pkg-shlib 8 ,
.Xr pkg-ssh 8 ,
.Xr pkg-stats 8 ,
.Xr pkg-update 8 ,
.Xr pkg-updating 8 ,
.Xr pkg-upgrade 8 ,
.Xr pkg-version 8 ,
.Xr pkg-which 8