Expand description
Sandbox creation and management.
This module provides the Sandbox struct for creating isolated build
environments using chroot. The implementation varies by platform but
presents a uniform interface.
§Platform Support
| Platform | Implementation |
|---|---|
| Linux | Mount namespaces + chroot |
| macOS | bindfs/devfs + chroot |
| NetBSD | Native mounts + chroot |
| illumos/Solaris | Platform mounts + chroot |
§Sandbox Lifecycle
- Create: Set up the sandbox directory and perform configured actions
- Execute: Run build scripts inside the sandbox via chroot
- Destroy: Reverse actions and clean up the sandbox directory
§Configuration
Sandboxes are configured in the sandboxes section of the Lua config file.
See the action module for available actions.
sandboxes = {
basedir = "/data/chroot/bob",
actions = {
{ action = "mount", fs = "proc", dir = "/proc" },
{ action = "mount", fs = "dev", dir = "/dev" },
{ action = "mount", fs = "bind", dir = "/usr/bin", opts = "ro" },
{ action = "copy", dir = "/etc" },
},
}§Multiple Sandboxes
Multiple sandboxes can be created for parallel builds. Each sandbox is
identified by an integer ID (0, 1, 2, …) and created as a subdirectory
of basedir.
With build_threads = 4, sandboxes are created at:
/data/chroot/bob/0/data/chroot/bob/1/data/chroot/bob/2/data/chroot/bob/3
Structs§
- Sandbox
- Build sandbox manager.