package pkgutil

import "github.com/tredoe/osutil/pkgutil"

Package pkgutil handles basic operations in the management of packages in operating systems.

Important

If you are going to use a package manager different to Deb, then you should check the options since I cann't test all.

TODO

Add managers of BSD systems.

Use flag to do not show questions.

Index

Types

type PackageType

type PackageType int8

PackageType represents a package management system.

const (
	// Linux
	Deb PackageType = iota + 1
	RPM
	Pacman
	Ebuild
	ZYpp
)

func Detect

func Detect() (PackageType, error)

Detect tries to get the package system used in the system, looking for executables in directory "/usr/bin".

func (PackageType) String

func (pkg PackageType) String() string

type Packager

type Packager interface {
	// Install installs packages.
	Install(name ...string) error

	// Remove removes packages.
	Remove(name ...string) error

	// Purge removes packages and its configuration files.
	Purge(name ...string) error

	// Update resynchronizes the package index files from their sources.
	Update() error

	// Upgrade upgrades all the packages on the system.
	Upgrade() error

	// Clean erases both packages downloaded and orphaned dependencies.
	Clean() error
}

Packager is the common interface to handle different package systems.

func New

func New(pkg PackageType) Packager

New returns the interface to handle the package manager.

Source Files

deb.go ebuild.go pacman.go pkg.go rpm.go zypp.go

Version
v1.5.0 (latest)
Published
Jun 4, 2024
Platform
linux/amd64
Imports
3 packages
Last checked
1 day ago

Tools for package owners.