Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Package tables are the primary way of setting up packages with unicornpkg. They MUST be a Lua table. The fields name, pkgType, and unicornSpec MUST be defined.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Fields

unicornSpec

This specifies the version of the package table. This should always be set to v1.1.0.

name

This should be the same as the filename without the .lua extension.

desc

A description of the contents of the package table, as a string. Can be single-line or multiline.

homepage

A link to the program's homepage, if it has one. If set, this MUST be an absolute-URL string as defined by the WHATWG URL Standard.

maintainer

The name or pseudonym of the maintainer of the package table. This MUST be expressed as a string, if set.

license

The license of the package's contents. This MUST be expressed as an SPDX License Expression as defined in the SPDX Specification, v3.0.1.

Package definitions MAY be a different license from the license of the package's contents.

SPDX extensions

Packages MAY use CCPL and MMPL in license expressions to refer to the ComputerCraft Public License and Minecraft Mod Public License, respectively. New projects SHOULD refrain from using these licenses. If CCPL or MMPL ever become defined in the SPDX License List, those definitions MUST take precedence.

Other than the exceptions above, implementations SHOULD avoid bespoke extensions to the SPDX License List.

version

The version of a package. If a project does not have versioning, this value SHOULD be set to nil.

This field expects a valid SemVer string, without the v prefix.

instdat

A table that contains more tables that have information specific to package providers.

Each table should be structured like this:

{
	{
		provider = "com.github";
		repo_owner = "unicornpkg";
		repo_name = "cli";
		filemaps = {
			["unicorntool/init.lua"] = "/bin/unicorntool.lua";
			["doc/man/unicorntool.txt"] = "/usr/share/help/unicorntool.txt";
		};
	};
	{
		provider = "com.github"; -- You can do multiple tables with the same `provider` value!
		repo_owner = "unicornpkg";
		repo_name = "some-nonexistent-repo";
		filemaps = {
			["init.lua"] = "/bin/some-nonexistent-program.lua";
		}
	};
}

See individual package providers for more information.

script

A table that contains scripts that should be called at various points in the package's life.

script.preinstall

This value, if set, MUST be a string of Lua source code. It SHOULD be executed before the package is installed.

script.postinstall

This value, if set, MUST be a string of Lua source code. It SHOULD be executed after the package is installed.

script.preremove

This value, if set, MUST be a string of Lua source code. It SHOULD be executed before the package is removed.

script.postremove

This value, if set, MUST be a string of Lua source code. It SHOULD be executed after the package is removed.

security

A table that contains hashes and other security-related data.

Implementations MUST prevent packages with invalid hashes from being installed.

security.sha256

A table that contains a name of the installed file (e.g. /bin/some-nonexistent-program.lua) and the corresponding SHA-256 hash represented as a 256-bit hexadecimal string.

SHA-256 hashes MUST be generated by a compliant implementation of FIPS 180-4, Secure Hash Standard (SHS), or a later revision of that standard.

rel

A table that contains information relating to other packages.

rel.depends

An integer-indexed table that lists required packages.

rel.conflicts

An integer-indexed table that lists packages which break when they are installed with this package.