2 .\" FreeBSD install - a package for the installation and maintainance
3 .\" of non-core utilities.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
18 .\" $FreeBSD: src/usr.sbin/pkg_install/create/pkg_create.1,v 1.35.2.16 2002/12/29 16:35:43 schweikh Exp $
19 .\" $DragonFly: src/usr.sbin/pkg_install/create/Attic/pkg_create.1,v 1.2 2003/06/17 04:29:59 dillon Exp $
21 .\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords,
22 .\" added dependency tracking, etc.
24 .\" [jkh] Took John's changes back and made some additional extensions for
25 .\" better integration with FreeBSD's new ports collection.
32 .Nd a utility for creating software package distributions
46 .Op Fl X Ar excludefile
47 .Op Fl D Ar displayfile
49 .Op Fl o Ar originpath
61 command is used to create packages that will subsequently be fed to
62 one of the package extraction/info utilities. The input description
63 and command line arguments for the creation of a package are not
64 really meant to be human-generated, though it is easy enough to
65 do so. It is more expected that you will use a front-end tool for
66 the job rather than muddling through it yourself. Nonetheless, a short
67 description of the input syntax is included in this document.
69 The following command line options are supported:
70 .Bl -tag -width indent
71 .It Fl f Ar packinglist
74 for package from the file
87 .Dq one line description
92 the argument itself. This string should also
93 give some idea of which version of the product (if any) the package
98 Fetch long description for package from file
104 Assume a default answer of `Yes' for any questions asked.
106 Assume a default answer of `No' for any questions asked.
108 Go into a `packing list Only' mode. This is a custom hack for the
110 .Em "Ports Collection"
111 and is used to do `fake pkg_add' operations when a port is installed.
112 In such cases, it is necessary to know what the final, adjusted packing
115 Turn on verbose output.
117 Force tar to follow symbolic links, so that the files they point to
118 are dumped, rather than the links themselves.
122 to be the pre-install procedure for the package. This can be any executable
123 program (or shell script). It will be invoked automatically when the
124 package is later installed.
125 It will be passed the package's name as the
131 option is not given, this script will serve as both the pre-install and the
132 post-install script for the package, differentiating between the
133 functionality by passing the keywords
137 respectively, along with the package's name.
141 to be the post-install procedure for the package. This can be any
142 executable program (or shell script). It will be invoked automatically
143 when the package is later installed.
144 It will be passed the package's name as
147 Set the initial package dependency list to
149 This is assumed to be a whitespace separated list of package names
150 and is meant as a convenient shorthand for specifying multiple
152 directives in the packing list (see
153 .Sx "PACKING LIST DETAILS"
155 Each argument from the
157 list could be in the form
158 .Ar pkgname Ns Op : Ns Ar pkgorigin ,
161 element denotes origin of each dependency from the list and it is
162 recorded into the packing list along with the
170 as the initial directory
172 to start from in selecting files for
177 to be the de-install procedure for the package. This can be any executable
178 program (or shell script). It will be invoked automatically when the
179 package is later (if ever) de-installed.
180 It will be passed the package's
181 name as the first argument.
186 option is not given, this script will serve as both the de-install and the
187 post-deinstall script for the package, differentiating between the
188 functionality by passing the keywords
192 respectively, along with the package's name.
196 to be the post-deinstall procedure for the package. This can be any
197 executable program (or shell script). It will be invoked automatically when
198 the package is later de-installed.
199 It will be passed the package's name as
206 procedure for the package. This can be any
207 executable program (or shell script). It will be invoked automatically
208 at installation/deinstallation time to determine whether or not
209 installation/deinstallation should proceed.
210 To differentiate between installation and deinstallation, the keywords
214 are passed respectively, along with the package's name.
217 will override the value of
219 during package creation.
225 By default, this is the string
226 .Pa /tmp/instmp.XXXXXX ,
227 but it may be necessary to override it in the situation where
230 directory is limited. Be sure to leave some number of `X' characters
233 to fill in with a unique ID.
234 .It Fl X Ar excludefile
241 when creating final package. See
247 flag) for further information on using this flag.
248 .It Fl D Ar displayfile
249 Display the file (by concatenating it to stdout)
250 after installing the package. Useful for things like
251 legal notices on almost-free software, etc.
252 .It Fl m Ar mtreefile
255 with input from mtreefile before the package is installed.
267 is the name of the first directory named by a
270 .It Fl o Ar originpath
273 as location of the port from which package has been created in the
275 .Em "Ports Collection" .
276 It should be in the form
277 .Pa MASTERCATEGORY/PORTDIR .
281 utility to compress package tarball instead of
283 Please note that this option is a NO-OP if the format of the resulting
284 archive is explicitly specified by the recognizable suffix of
288 recognizes the following suffixes:
293 Compatibility synonym for
298 utility to compress package tarball.
300 Create package file from a locally installed package named
304 is not specified, then resulting archive will be created in the
305 current directory and named
307 with an appropriate extraction suffix applied.
309 .Sh PACKING LIST DETAILS
314 is fairly simple, being
315 nothing more than a single column of filenames to include in the
316 package. However, since absolute pathnames are generally a bad idea
317 for a package that could be installed potentially anywhere, there is
318 another method of specifying where things are supposed to go
319 and, optionally, what ownership and mode information they should be
320 installed with. This is done by embedding specialized command sequences
321 in the packing list. Briefly described, these sequences are:
322 .Bl -tag -width indent -compact
323 .It Cm @cwd Ar directory
324 Set the internal directory pointer to point to
326 All subsequent filenames will be assumed relative to this directory.
329 is also an alias for this command.
330 .It Cm @srcdir Ar directory
331 Set the internal directory pointer for _creation only_ to
333 That is to say that it overrides
335 for package creation but not extraction.
336 .It Cm @exec Ar command
339 as part of the unpacking process. If
341 contains any of the following sequences somewhere in it, they will
342 be expanded inline. For the following examples, assume that
346 and the last extracted file was
348 .Bl -tag -width indent -compact
350 Expands to the last filename extracted (as specified), in the example case
353 Expand to the current directory prefix, as set with
360 of the fully qualified filename, that
361 is the current directory prefix, plus the last filespec, minus
362 the trailing filename. In the example case, that would be
367 part of the fully qualified name, or
370 being in the example case,
373 .It Cm @unexec Ar command
376 as part of the deinstallation process. Expansion of special
378 sequences is the same as for
380 This command is not executed during the package add, as
382 is, but rather when the package is deleted. This is useful
383 for deleting links and other ancillary files that were created
384 as a result of adding the package, but not directly known to
385 the package's table of contents (and hence not automatically
386 removable). The advantage of using
388 over a deinstallation script is that you can use the
389 .Dq special sequence expansion
390 to get at files regardless of where they've
391 been potentially redirected (see
394 Set default permission for all subsequently extracted files to
396 Format is the same as that used by the
398 command (well, considering that it's later handed off to it, that's
399 no surprise). Use without an arg to set back to default (extraction)
401 .It Cm @option Ar option
402 Set internal package options, the only two currently supported ones
404 .Ar extract-in-place ,
405 which tells the pkg_add command not to extract the package's tarball
406 into a staging area but rather directly into the target
407 hierarchy (this is typically meant to be used only by distributions
408 or other special package types), and
410 which tells pkg_add to move any existing files out of the way,
411 preserving the previous contents (which are also resurrected on
412 pkg_delete, so caveat emptor).
413 .It Cm @owner Ar user
414 Set default ownership for all subsequently extracted files to
416 Use without an arg to set back to default (extraction)
418 .It Cm @group Ar group
419 Set default group ownership for all subsequently extracted files to
421 Use without an arg to set back to default (extraction)
423 .It Cm @comment Ar string
424 Imbed a comment in the packing list. Useful in
425 trying to document some particularly hairy sequence that
426 may trip someone up later.
428 Used internally to tell extraction to ignore the next file (don't
429 copy it anywhere), as it's used for some special purpose.
433 but the ignoring of the next file is delayed one evaluation cycle. This
434 makes it possible to use this directive in the
436 file, so you can pack a
437 specialized datafile in with a distribution for your install script (or
438 something) yet have the installer ignore it.
440 Set the name of the package. This is mandatory and is usually
441 put at the top. This name is potentially different from the name of
442 the file it came in, and is used when keeping track of the package
443 for later deinstallation. Note that
445 will derive this field from the package name and add it automatically
447 .It Cm @dirrm Ar name
450 to be deleted at deinstall time. By default, directories created by a
451 package installation are not deleted when the package is deinstalled;
452 this provides an explicit directory cleanup method. This directive
453 should appear at the end of the package list. If more than one
455 directives are used, the directories are removed in the order specified.
458 directory will not be removed unless it is empty.
459 .It Cm @mtree Ar name
464 input file to be used at install time (see
466 above). Only the first
468 directive is honored.
469 .It Cm @display Ar name
472 as the file to be displayed at install time (see
475 .It Cm @pkgdep Ar pkgname
476 Declare a dependency on the
480 package must be installed before this package may be
481 installed, and this package must be deinstalled before the
483 package is deinstalled. Multiple
485 directives may be used if the package depends on multiple other packages.
488 The environment variable
490 names the directory where
492 will attempt to create its temporary files.
496 the directory named by the contents of
503 are set, the builtin defaults are used.
505 .Bl -tag -width /usr/tmp -compact
507 Temporary directory if environmental variables
531 command first appeared in
536 .An John Kohl Aq jtk@rational.com
538 Hard links between files in a distribution must be bracketed by
540 directives in order to be preserved as hard links when the package is
541 extracted. They additionally must not end up being split between
543 invocations due to exec argument-space limitations (this depends on the
545 .Fn sysconf _SC_ARG_MAX ) .