Table of Contents

Name

mkjail -- create a full-system prison environment

Synopsis

mkjail [-c dir] [-d devs] [-s sets] pkg_dir jail_dir mkjail [-d devs] jail_dir

Description

-c dir
Keep downloaded packages in dir. The package directory hierarchy will be re-created under this root allowing for subsequent fetches with dir as the pkg_dir.

-d devs
Specify a device profile to build in jail_dir. Creates all devices necessary for common services. This may be one of base, all, ssh, https, or http. The all option creates devices for all service options.

-s sets
Download an alternate set of packages. The default is base, etc, and man.

pkg_dir Absolute URI of packages. May be any schema supported by ftp(1) . This is the base root of the package directory hierarchy.

jail_dir Prison root. Sets are unpacked into this directory with the permissions preserved from the archive.

The mkjail script requires superuser permissions in order to operate, as it calls mknod(1) and other superuser tools.

This script can also be site-configured by also specifying site and/or sitelocal with the -s flag. This will cause siteXY.tgz and/or siteXYbasename.tgz to be extracted, where basename is the jail directory's path name (e.g., foo for /jails/foo).

If the /install.site script is specified in the jail directory, then it will be automatically executed in a chroot of the jail directory.

If pkg_dir isn't specified, mkjail assumes that it's being called after an initial installation. This changes the argument behaviour: the -d flag, to create devices, will clear the device directory beforehand. If -d isn't specified, the install.site script is (re-)executed and mkjail exits.

Examples

Fetching from an OpenBSD ftp site without a back-up cache:

# mkjail ftp://site/pub/OpenBSD /jails/openbsd

The same, but from an http site:

# mkjail http://site/pub/OpenBSD /jails/openbsd

Fetching from a remote host and caching locally:

# mkjail -c /tmp/nbsd ftp://site/pub/OpenBSD /jails/netbsd

Re-using the cache directory and adding httpd(8) support:

# mkjail -d http file://tmp/nbsd /jails/netbsd-2

Return Values

The mkjail utility returns 0 on success, 1 on failure.

See Also

sysjail(3) , sjls(1) , sysjail(1) , jls(1)

History

The mkjail tool is a complete re-write of sysjail 1.0.4.

Authors

The mkjail script was written by Kristaps Dzonsons for the bsd.lv project.


Table of Contents