Documentation
¶
Index ¶
- func AutoEnableFakeroot(lastImg string, writable bool, currentFakeroot bool) bool
- func BindPaths(paths ...string) []string
- func BuildPathEnv(overlays []string) string
- func CollectOverlayEnv(paths []string) (map[string]string, map[string]string)
- func DeduplicateBindPaths(paths []string) []string
- func DetectGPUFlags() []string
- func FormatOverlayMount(path string, writable bool) string
- func InstalledOverlays() (map[string]string, error)
- func InvalidateInstalledOverlaysCache()
- func ResolveOverlayPaths(inputs []string) ([]string, error)
- type SetupConfig
- type SetupResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoEnableFakeroot ¶
AutoEnableFakeroot checks if fakeroot should be auto-enabled for writable .img overlays Returns the updated fakeroot setting
func BindPaths ¶
BindPaths collects all directories suitable for --bind flags. Deduplication and child path filtering is handled by DeduplicateBindPaths().
func BuildPathEnv ¶
BuildPathEnv constructs the PATH environment variable based on overlays. When MPI_DIR is set (exported by condatainer when ntasks > 1), its bin/ is prepended so MPI tools are accessible inside the container.
func CollectOverlayEnv ¶
CollectOverlayEnv reads .env files from overlay paths and returns environment configs and notes
func DeduplicateBindPaths ¶
DeduplicateBindPaths resolves, deduplicates, and filters child paths from bind directories. It handles formats: "/path", "/path:/container", "/path:/container:ro"
func DetectGPUFlags ¶
func DetectGPUFlags() []string
DetectGPUFlags inspects the host for GPU support and returns the necessary apptainer flags.
func FormatOverlayMount ¶
FormatOverlayMount formats an overlay path with the appropriate :ro or :rw suffix
func InstalledOverlays ¶
InstalledOverlays scans all image search paths and returns a mapping from normalized overlay names to their absolute file path. Searches user → scratch → legacy → system directories. First match wins (user overlays shadow system ones). Result is cached for the lifetime of the process; call InvalidateInstalledOverlaysCache after installing a new overlay.
func InvalidateInstalledOverlaysCache ¶ added in v1.3.0
func InvalidateInstalledOverlaysCache()
InvalidateInstalledOverlaysCache clears the cached overlay map so the next call to InstalledOverlays rescans the image directories.
func ResolveOverlayPaths ¶
ResolveOverlayPaths coerces user input into absolute overlay paths that exist on disk.
Types ¶
type SetupConfig ¶
type SetupConfig struct {
Overlays []string // Overlay paths (will be resolved)
WritableImg bool // Whether .img overlays should be writable
EnvSettings []string // User-specified environment variables (KEY=VALUE format)
BindPaths []string // User-specified bind paths
Fakeroot bool // Whether to use fakeroot
ApptainerFlags []string // Additional apptainer flags to pass through
}
SetupConfig holds all configuration needed to set up a container
type SetupResult ¶
type SetupResult struct {
Overlays []string // Resolved and ordered overlay paths
OverlayArgs []string // Overlay paths with :ro/:rw suffixes
EnvList []string // Complete environment variable list
EnvNotes map[string]string // Environment variable notes for display
BindPaths []string // Deduplicated bind paths
Fakeroot bool // Final fakeroot setting (may be auto-enabled)
ApptainerFlags []string // Apptainer flags including GPU flags
LastImg string // Path to .img overlay if present
}
SetupResult contains all the processed configuration ready for container execution
func Setup ¶
func Setup(cfg SetupConfig) (*SetupResult, error)
Setup processes all container configuration and returns a ready-to-use result