Documentation
¶
Overview ¶
Package platform provides ownership preservation utilities for sudo environments.
Package platform provides system and platform detection utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GOSetup ¶
func GOSetup() error
GOSetup installs and configures the Go compiler if not already present.
func GetArchitecture ¶
func GetArchitecture() string
GetArchitecture returns the system architecture mapped to package manager conventions.
func IsRunningSudo ¶
func IsRunningSudo() bool
IsRunningSudo returns true if yap is currently running under sudo.
func PreserveOwnership ¶
PreserveOwnership changes ownership to original user if running under sudo.
func PreserveOwnershipRecursive ¶
PreserveOwnershipRecursive recursively changes ownership to original user if under sudo.
func PullContainers ¶
PullContainers downloads the specified container image for the given distribution.
Types ¶
type OSRelease ¶
type OSRelease struct {
ID string
Codename string // VERSION_CODENAME from /etc/os-release (e.g. "jammy" for Ubuntu 22.04)
}
OSRelease represents operating system release information.
func ParseOSRelease ¶
ParseOSRelease reads and parses the /etc/os-release file. It populates ID (e.g. "ubuntu") and Codename (e.g. "jammy") from the VERSION_CODENAME field so that callers can resolve distro-codename-specific PKGBUILD directives such as depends__ubuntu_jammy.
type OriginalUser ¶
OriginalUser holds information about the original user when running under sudo.
func GetOriginalUser ¶
func GetOriginalUser() (*OriginalUser, error)
GetOriginalUser detects if yap is running under sudo and returns original user info. Returns (nil, nil) if not running under sudo - this is not an error condition.
func (*OriginalUser) ChownRecursiveToOriginalUser ¶
func (ou *OriginalUser) ChownRecursiveToOriginalUser(path string) error
ChownRecursiveToOriginalUser recursively changes ownership of directory to original user.
func (*OriginalUser) ChownToOriginalUser ¶
func (ou *OriginalUser) ChownToOriginalUser(path string) error
ChownToOriginalUser changes ownership of the given path to the original user.