/ features.md
features.md
  1  # List of Features supported by pkg
  2  
  3  ## Scripts
  4  
  5  Before running any scripts pkg will become the reaper of its children,
  6  spawn the scripts and kill all the remaining process after the script
  7  if finished. This is done in order to prevent the scripts from running
  8  daemons.
  9  
 10  ### shell scripts
 11  
 12  shells scripts are scripts run by /bin/sh at various phases:
 13  
 14   - post-install
 15   - pre-install
 16   - post-deinstall
 17   - pre-deinstall
 18  
 19  It provides the following environment variables (see pkg-script(5) for
 20  documentation)
 21  
 22   - PKG\_PREFIX
 23   - PKG\_ROOTDIR
 24   - PKG\_MSGFD
 25   - PKG\_UPGRADE
 26  
 27  ### lua scripts
 28  
 29  One of the particulatiry of the lua scripts is the fact they always run in
 30  a capsicum sandbox which prevent doing anything but accessing the filesystem
 31  
 32  Another particularity is they run in a modified version of lua which makes all
 33  IO operation seamlessly rootdir friendly.
 34  
 35  Last they do prevent executing any external program, which make the lua scripts
 36  cross installation friendly
 37  
 38  They run at various phases:
 39  
 40   - post-install
 41   - pre-install
 42   - post-deinstall
 43   - pre-deinstall
 44  
 45  see pkg-lua-script(5) for the provided API
 46  
 47  Note that lua scripts are always run before shell scripts
 48  
 49  ## plist parsing (FreeBSD only)
 50  
 51  Feature available in the plist parser (see pkg-create(8) for more details)
 52  
 53  The format is the following
 54  
 55  > @keyword(user,group,mode) line
 56  
 57  or
 58  
 59  > @keyword line
 60  
 61  Hardcoded keywords:
 62  
 63   - @cwd
 64   - @mode
 65   - @owner
 66   - @group
 67   - @comment
 68   - @dir
 69  
 70  if a Keyword is not found then the hardworded keywords, pkg will lookup for it
 71  in a dedicated directory for files named
 72  
 73  > "keyword".ucl
 74  
 75  Those files supports shell scripts and lua scripts, see pkg-keywords(5) for details.
 76  
 77  ## message
 78  
 79  pkg supports messages in UCL format which allows to specify when a message should
 80  be presented to the users:
 81  
 82   - always
 83   - on first install
 84   - on upgrade
 85   - on deletion
 86  
 87  ## rootdir
 88  
 89  pkg is rootdir friendly it means pkg can install files as a user in a root
 90  directory as if it was a chroot.
 91  
 92  ## reproducible builds
 93  
 94  a timestamp can be provided at creation time to ensure the time used when
 95  create the package is crontrol activating the reproducible build support.
 96  
 97  ## graphviz/dot file visualisation
 98  
 99  by running pkg -o DOT\_FILE=something.dot or by exporting the environement
100  variable, pkg can generate a dot file allowing to visualise the internal
101  dependency tree via graphviz
102  
103  ## aliases
104  
105  Aliases supported at runtime so one can create its own commands
106  
107  ## Json output
108  
109  pkg can write to a unix socket or a unix pipe via the EVENT\_PIPE configuration
110  entry:
111  
112  > pkg -o EVENT\_PIPE=path ...
113  
114  this way all the event from pkg: progress of installation, warning etc will be
115  written in json format in those pipes allowing to easily write wrappers on top
116  of pkg.
117  
118  ## ssh protocol
119  
120  packages can be installed over ssh
121  
122  ## sandboxing
123  
124  Most of pkg operation are run inside capsicum sandbox when possible
125  
126  ## auto backup of libraries on upgrade
127  
128  When BACKUP\_LIBRARIES is set to true, pkg will keep backups of the libraries
129  it may remove during upgrades
130  
131  ## METALOG
132  
133  It is possible to ask pkg to create a metalog file to keep trace of what files
134  are being installed and how they should be packaged (mode, user, group etc)
135  usefull when installing in rootdir
136  
137  ## Provides/Requires
138  
139  ### automated via shlibs
140  
141  pkg automatically keep track of the libraries exposed by a packages and required
142  by a packages. (it is possible to disable this behaviour via BUNDLE\_LIB variable
143  
144  ### manual via provides/requires keywords
145  
146  What the title says
147  
148  ## Compression format
149  
150  pkg supports the following compression format:
151  
152   - zstd
153   - xz
154   - bzip2
155   - gz
156   - none