packagemanager

package
v1.11.2-dev-20260322 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PackageManagerUnknown             = PackageManagerType("")
	PackageManagerApt                 = PackageManagerType("apt")
	PackageManagerYum                 = PackageManagerType("yum")
	PackageManagerZypper              = PackageManagerType("zypper")
	PackageManagerTransactionalUpdate = PackageManagerType("transactional-update")
	PackageManagerPacman              = PackageManagerType("pacman")
)

Variables

View Source
var (
	ErrPackageNotInstalled = errors.New("package not installed")
	ServiceNotFoundRegex   = regexp.MustCompile(`Unit \S+\.service (not found|could not be found)`)
)

Functions

This section is empty.

Types

type AptPackageManager

type AptPackageManager struct {
	// contains filtered or unexported fields
}

func NewAptPackageManager

func NewAptPackageManager(executor *commonns.Executor) *AptPackageManager

func (*AptPackageManager) CheckModLoaded

func (c *AptPackageManager) CheckModLoaded(module string) error

CheckModLoaded checks if a module is loaded

func (*AptPackageManager) CheckPackageInstalled

func (c *AptPackageManager) CheckPackageInstalled(name string) (output string, err error)

CheckPackageInstalled checks if a package is installed

func (*AptPackageManager) Execute

func (c *AptPackageManager) Execute(envs []string, binary string, args []string, timeout time.Duration) (string, error)

Execute executes the given command with the specified environment variables, binary, and arguments.

func (*AptPackageManager) GetServiceStatus

func (c *AptPackageManager) GetServiceStatus(name string) (string, error)

GetServiceStatus executes the service status command

func (*AptPackageManager) InstallPackage

func (c *AptPackageManager) InstallPackage(name string) (string, error)

InstallPackage executes the installation command

func (*AptPackageManager) Modprobe

func (c *AptPackageManager) Modprobe(module string, opts ...string) (string, error)

Modprobe executes the modprobe command

func (*AptPackageManager) NeedReboot added in v1.9.0

func (c *AptPackageManager) NeedReboot() bool

NeedReboot tells if a reboot is needed after package installation

func (*AptPackageManager) RestartService added in v1.10.0

func (c *AptPackageManager) RestartService(name string) (string, error)

RestartService executes the service restart command

func (*AptPackageManager) StartPackageSession added in v1.9.0

func (c *AptPackageManager) StartPackageSession() (string, error)

StartPackageSession start a session to install/uninstall packages in a unique transaction

func (*AptPackageManager) StartService

func (c *AptPackageManager) StartService(name string) (string, error)

StartService executes the service start command

func (*AptPackageManager) UninstallPackage

func (c *AptPackageManager) UninstallPackage(name string) (string, error)

UninstallPackage executes the uninstallation command

func (*AptPackageManager) UpdatePackageList

func (c *AptPackageManager) UpdatePackageList() (string, error)

UpdatePackageList updates list of available packages

type PackageManager

type PackageManager interface {
	UpdatePackageList() (string, error)
	StartPackageSession() (string, error)
	InstallPackage(name string) (string, error)
	UninstallPackage(name string) (string, error)
	Modprobe(module string, opts ...string) (string, error)
	CheckModLoaded(module string) error
	StartService(name string) (string, error)
	RestartService(name string) (string, error)
	GetServiceStatus(name string) (string, error)
	CheckPackageInstalled(name string) (string, error)
	Execute(envs []string, binary string, args []string, timeout time.Duration) (string, error)
	NeedReboot() bool
}

func New

func New(pkgMgrType PackageManagerType, executor *commonns.Executor) (PackageManager, error)

type PackageManagerType

type PackageManagerType string

type PacmanPackageManager

type PacmanPackageManager struct {
	// contains filtered or unexported fields
}

func NewPacmanPackageManager

func NewPacmanPackageManager(executor *commonns.Executor) *PacmanPackageManager

func (*PacmanPackageManager) CheckModLoaded

func (c *PacmanPackageManager) CheckModLoaded(module string) error

CheckModLoaded checks if a module is loaded

func (*PacmanPackageManager) CheckPackageInstalled

func (c *PacmanPackageManager) CheckPackageInstalled(name string) (string, error)

CheckPackageInstalled checks if a package is installed

func (*PacmanPackageManager) Execute

func (c *PacmanPackageManager) Execute(envs []string, binary string, args []string, timeout time.Duration) (string, error)

Execute executes the given command with the specified environment variables, binary, and arguments.

func (*PacmanPackageManager) GetServiceStatus

func (c *PacmanPackageManager) GetServiceStatus(name string) (string, error)

GetServiceStatus executes the service status command

func (*PacmanPackageManager) InstallPackage

func (c *PacmanPackageManager) InstallPackage(name string) (string, error)

InstallPackage executes the installation command

func (*PacmanPackageManager) Modprobe

func (c *PacmanPackageManager) Modprobe(module string, opts ...string) (string, error)

Modprobe executes the modprobe command

func (*PacmanPackageManager) NeedReboot added in v1.9.0

func (c *PacmanPackageManager) NeedReboot() bool

NeedReboot tells if a reboot is needed after package installation

func (*PacmanPackageManager) RestartService added in v1.10.0

func (c *PacmanPackageManager) RestartService(name string) (string, error)

RestartService executes the service restart command

func (*PacmanPackageManager) StartPackageSession added in v1.9.0

func (c *PacmanPackageManager) StartPackageSession() (string, error)

StartPackageSession start a session to install/uninstall packages in a unique transaction

func (*PacmanPackageManager) StartService

func (c *PacmanPackageManager) StartService(name string) (string, error)

StartService executes the service start command

func (*PacmanPackageManager) UninstallPackage

func (c *PacmanPackageManager) UninstallPackage(name string) (string, error)

UninstallPackage executes the uninstallation command

func (*PacmanPackageManager) UpdatePackageList

func (c *PacmanPackageManager) UpdatePackageList() (string, error)

UpdatePackageList updates list of available packages

type TransactionalUpdatePackageManager

type TransactionalUpdatePackageManager struct {
	// contains filtered or unexported fields
}

func NewTransactionalUpdatePackageManager

func NewTransactionalUpdatePackageManager(executor *commonns.Executor) *TransactionalUpdatePackageManager

func (*TransactionalUpdatePackageManager) CheckModLoaded

func (c *TransactionalUpdatePackageManager) CheckModLoaded(module string) error

CheckModLoaded checks if a module is loaded

func (*TransactionalUpdatePackageManager) CheckPackageInstalled

func (c *TransactionalUpdatePackageManager) CheckPackageInstalled(name string) (string, error)

CheckPackageInstalled checks if a package is installed

func (*TransactionalUpdatePackageManager) Execute

func (c *TransactionalUpdatePackageManager) Execute(envs []string, binary string, args []string, timeout time.Duration) (string, error)

Execute executes the given command with the specified environment variables, binary, and arguments.

func (*TransactionalUpdatePackageManager) GetServiceStatus

func (c *TransactionalUpdatePackageManager) GetServiceStatus(name string) (string, error)

GetServiceStatus executes the service status command

func (*TransactionalUpdatePackageManager) InstallPackage

func (c *TransactionalUpdatePackageManager) InstallPackage(name string) (string, error)

InstallPackage executes the installation command

func (*TransactionalUpdatePackageManager) Modprobe

func (c *TransactionalUpdatePackageManager) Modprobe(module string, opts ...string) (string, error)

Modprobe executes the modprobe command

func (*TransactionalUpdatePackageManager) NeedReboot added in v1.9.0

func (c *TransactionalUpdatePackageManager) NeedReboot() bool

NeedReboot tells if a reboot is needed after package installation Note: SLE Micro OS always requires a reboot after package installation to ensure newly installed packages are properly integrated into the system's operational environment

func (*TransactionalUpdatePackageManager) RestartService added in v1.10.0

func (c *TransactionalUpdatePackageManager) RestartService(name string) (string, error)

RestartService executes the service restart command

func (*TransactionalUpdatePackageManager) StartPackageSession added in v1.9.0

func (c *TransactionalUpdatePackageManager) StartPackageSession() (string, error)

StartPackageSession start a session to install/uninstall packages in a unique transaction Note: with this command we create a layer so that each following package installation can use the --continue option

func (*TransactionalUpdatePackageManager) StartService

func (c *TransactionalUpdatePackageManager) StartService(name string) (string, error)

StartService executes the service start command

func (*TransactionalUpdatePackageManager) UninstallPackage

func (c *TransactionalUpdatePackageManager) UninstallPackage(name string) (string, error)

UninstallPackage executes the uninstallation command

func (*TransactionalUpdatePackageManager) UpdatePackageList

func (c *TransactionalUpdatePackageManager) UpdatePackageList() (string, error)

UpdatePackageList updates list of available packages

type YumPackageManager

type YumPackageManager struct {
	// contains filtered or unexported fields
}

func NewYumPackageManager

func NewYumPackageManager(executor *commonns.Executor) *YumPackageManager

func (*YumPackageManager) CheckModLoaded

func (c *YumPackageManager) CheckModLoaded(module string) error

CheckModLoaded checks if a module is loaded

func (*YumPackageManager) CheckPackageInstalled

func (c *YumPackageManager) CheckPackageInstalled(name string) (string, error)

CheckPackageInstalled checks if a package is installed

func (*YumPackageManager) Execute

func (c *YumPackageManager) Execute(envs []string, binary string, args []string, timeout time.Duration) (string, error)

Execute executes the given command with the specified environment variables, binary, and arguments.

func (*YumPackageManager) GetServiceStatus

func (c *YumPackageManager) GetServiceStatus(name string) (string, error)

GetServiceStatus executes the service status command

func (*YumPackageManager) InstallPackage

func (c *YumPackageManager) InstallPackage(name string) (string, error)

InstallPackage executes the installation command

func (*YumPackageManager) Modprobe

func (c *YumPackageManager) Modprobe(module string, opts ...string) (string, error)

Modprobe executes the modprobe command

func (*YumPackageManager) NeedReboot added in v1.9.0

func (c *YumPackageManager) NeedReboot() bool

NeedReboot tells if a reboot is needed after package installation

func (*YumPackageManager) RestartService added in v1.10.0

func (c *YumPackageManager) RestartService(name string) (string, error)

RestartService executes the service restart command

func (*YumPackageManager) StartPackageSession added in v1.9.0

func (c *YumPackageManager) StartPackageSession() (string, error)

StartPackageSession start a session to install/uninstall packages in a unique transaction

func (*YumPackageManager) StartService

func (c *YumPackageManager) StartService(name string) (string, error)

StartService executes the service start command

func (*YumPackageManager) UninstallPackage

func (c *YumPackageManager) UninstallPackage(name string) (string, error)

UninstallPackage executes the uninstallation command

func (*YumPackageManager) UpdatePackageList

func (c *YumPackageManager) UpdatePackageList() (string, error)

UpdatePackageList updates list of available packages

type ZypperPackageManager

type ZypperPackageManager struct {
	// contains filtered or unexported fields
}

func NewZypperPackageManager

func NewZypperPackageManager(executor *commonns.Executor) *ZypperPackageManager

func (*ZypperPackageManager) CheckModLoaded

func (c *ZypperPackageManager) CheckModLoaded(module string) error

CheckModLoaded checks if a module is loaded

func (*ZypperPackageManager) CheckPackageInstalled

func (c *ZypperPackageManager) CheckPackageInstalled(name string) (string, error)

CheckPackageInstalled checks if a package is installed

func (*ZypperPackageManager) Execute

func (c *ZypperPackageManager) Execute(envs []string, binary string, args []string, timeout time.Duration) (string, error)

Execute executes the given command with the specified environment variables, binary, and arguments.

func (*ZypperPackageManager) GetServiceStatus

func (c *ZypperPackageManager) GetServiceStatus(name string) (string, error)

GetServiceStatus executes the service status command

func (*ZypperPackageManager) InstallPackage

func (c *ZypperPackageManager) InstallPackage(name string) (string, error)

InstallPackage executes the installation command

func (*ZypperPackageManager) Modprobe

func (c *ZypperPackageManager) Modprobe(module string, opts ...string) (string, error)

Modprobe executes the modprobe command

func (*ZypperPackageManager) NeedReboot added in v1.9.0

func (c *ZypperPackageManager) NeedReboot() bool

NeedReboot tells if a reboot is needed after package installation

func (*ZypperPackageManager) RestartService added in v1.10.0

func (c *ZypperPackageManager) RestartService(name string) (string, error)

RestartService executes the service restart command

func (*ZypperPackageManager) StartPackageSession added in v1.9.0

func (c *ZypperPackageManager) StartPackageSession() (string, error)

StartPackageSession start a session to install/uninstall packages in a unique transaction

func (*ZypperPackageManager) StartService

func (c *ZypperPackageManager) StartService(name string) (string, error)

StartService executes the service start command

func (*ZypperPackageManager) UninstallPackage

func (c *ZypperPackageManager) UninstallPackage(name string) (string, error)

UninstallPackage executes the uninstallation command

func (*ZypperPackageManager) UpdatePackageList

func (c *ZypperPackageManager) UpdatePackageList() (string, error)

UpdatePackageList updates list of available packages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL