pkg_create,
pkg_create_i,
pkg_create_new,
pkg_create_free,
pkg_create_set_format,
pkg_create_set_overwrite,
pkg_create_set_compression_level,
pkg_create_set_rootdir,
pkg_create_set_output_dir,
pkg_create_set_timestamp,
pkg_create_set_compression_threads —
create packages
#include
<pkg.h>
struct pkg_create *
pkg_create_new();
void
pkg_create_free(struct
pkg_create *);
bool
pkg_create_set_format(struct
pkg_create *, const char
*);
void
pkg_create_set_compression_level(struct
pkg_create *,
int);
void
pkg_create_set_compression_threads(struct
pkg_create *,
int);
void
pkg_create_set_overwrite(struct
pkg_create *,
bool);
void
pkg_create_set_rootdir(struct
pkg_create *, const char
*);
void
pkg_create_set_output_dir(struct
pkg_create *, const char
*);
void
pkg_create_set_timestamp(struct
pkg_create *,
time_t);
int
pkg_create(struct
pkg_create *, const char
*, const char *,
bool);
int
pkg_create_i(struct
pkg_create *, struct pkg
*, bool);
pkg_create_new()
Allocates a new struct pkg_create * which should be
freed by the caller using
pkg_create_free().
pkg_create_set_format()
will define the compression format to use. By default "txz" except
if specified otherwise in
pkg.conf(5). It returns false if the
compression format is unknown and will fall back to the default format.
pkg_create_set_compression_level()
takes an int argument which represents the expected
compression level. 3 special values are accepted:
- INT_MIN
- Set the fastest compression format value
- 0
- Set the default (as specified in libarchive)
- INT_MAX
- Set the best compression ratio
pkg_create_set_compression_threads()
takes an int argument which represents the expected
number of threads used during compression.
pkg_create_set_overwrite()
Accepts a boolean to define the default behaviour when creating a package if
a local file already exists. The default behaviour is to overwrite.
pkg_create_set_rootdir()
Tells the program where to find the root directory used for packaging (this
directory is also known as the staging area). If none is provided pkg will
consider ‘/’.
pkg_create_set_output_dir()
Tells the program where to create the new packages. By default it will
consider the current directory of the running program.
pkg_create_set_timestamp()
Define the timestamp to use as the creation and modification time for the
files to be packaged. By default it will use the timestamp of the files on
the filesystem.
pkg_create()
create a package from scratch using the metadata and
plist as input. The metadata can
be either directly a UCL manifest, or a directory containing multiple
files:
- +MANIFEST
- The UCL manifest
- +DESC
- A textual description (optional)
- shell scripts (optional):
-
- +INSTALL
- Shell script that will be run during both post and pre install
(DEPRECATED)
- +PRE_INSTALL
- Shell script that will be run during pre install phase
- +POST_INSTALL
- Shell script that will be run during post install phase
- +DEINSTALL
- Shell script that will be run during both post and pre deinstall
(DEPRECATED)
- +PRE_DEINSTALL
- Shell script that will be run during pre deinstall phase
- +POST_DEINSTALL
- Shell script that will be run during post deinstall phase
- pkg-install
- Shell script that will be run during both post and pre install
(DEPRECATED)
- pkg-pre-install
- Shell script that will be run during pre install phase
- pkg-post-install
- Shell script that will be run during post install phase
- pkg-deinstall
- Shell script that will be run during both post and pre deinstall
(DEPRECATED)
- pkg-pre-deinstall
- Shell script that will be run during pre deinstall phase
- pkg-post-deinstall
- Shell script that will be run during post deinstall phase
- lua scripts (optional):
-
- pkg-pre-install.lua
- Lua script that will be run during pre install phase
- pkg-post-install.lua
- Lua script that will be run during post install phase
- pkg-pre-deinstall.lua
- Lua script that will be run during pre deinstall phase
- pkg-post-deinstall.lua
- Lua script that will be run during post deinstall phase
pkg_create_i()
create a package for the provided installed pkg. If
hash is set to true then the
file name will be in the form:
<pkgname>-<pkgversion>-<shorthash>.<extention>
instead of <pkgname>-<pkgversion>.<extension>.