Reference

pkg-serve(8)

serve pkg repositories over TCP via inetd

NAME

pkg-serve – serve pkg repositories over TCP via inetd

SYNOPSIS

pkg-serve basedir

DESCRIPTION

The pkg-serve utility serves pkg(8) repositories using the pkg TCP protocol. It is designed to be invoked by inetd(8) and communicates via standard input and output.

The basedir argument specifies the root directory containing the package repositories. All file requests are resolved relative to this directory.

On startup, pkg-serve enters a Capsicum sandbox, restricting filesystem access to basedir.

PROTOCOL

The protocol is line-oriented. Upon connection, the server sends a greeting:

ok: pkg-serve <version>

The client may then issue commands:

get file age

Request a file. If the file's modification time is newer than age (a Unix timestamp), the server responds with:

ok: <size>

followed by size bytes of file data. If the file has not been modified, the server responds with:

ok: 0

On error, the server responds with:

ko: <error message>

quit

Close the connection.

INETD CONFIGURATION

Add the following line to inetd.conf(5):

pkg  stream  tcp  nowait  nobody  /usr/libexec/pkg-serve  pkg-serve /usr/local/poudriere/data/packages

And define the service in services(5):

pkg     62000/tcp

REPOSITORY CONFIGURATION

On the client side, configure a repository in /usr/local/etc/pkg/repos/myrepo.conf to use the tcp:// scheme:

myrepo: {
    url: "tcp://pkgserver.example.com:62000/myrepo",
}

The path component of the URL is resolved relative to the basedir given to pkg-serve. For example, if pkg-serve is started with /usr/local/poudriere/data/packages as basedir, the above configuration will serve files from /usr/local/poudriere/data/packages/myrepo/.

SEE ALSO

inetd.conf(5), inetd(8), pkg(8)

AUTHORS

Baptiste Daroussin ⟨[email protected]⟩