package osutil
import "github.com/tredoe/osutil"
Package osutil defines operating systems and detects the Linux distribution. Also, it handles basic operations in the management of packages in FreeBSD, Linux and macOs operating systems.
Index ¶
- Variables
- func SetupLogger(log, logShell *log.Logger)
- func SystemFromGOOS() (sys System, dist Distro, err error)
- type Distro
- type Manager
- type ManagerBrew
- func (p ManagerBrew) Clean() error
- func (p ManagerBrew) Install(name ...string) error
- func (p ManagerBrew) Purge(name ...string) error
- func (p ManagerBrew) Remove(name ...string) error
- func (p ManagerBrew) Update() error
- func (p ManagerBrew) Upgrade() error
- type ManagerDeb
- func (p ManagerDeb) Clean() error
- func (p ManagerDeb) Install(name ...string) error
- func (p ManagerDeb) Purge(name ...string) error
- func (p ManagerDeb) Remove(name ...string) error
- func (p ManagerDeb) Update() error
- func (p ManagerDeb) Upgrade() error
- type ManagerEbuild
- func (p ManagerEbuild) Clean() error
- func (p ManagerEbuild) Install(name ...string) error
- func (p ManagerEbuild) Purge(name ...string) error
- func (p ManagerEbuild) Remove(name ...string) error
- func (p ManagerEbuild) Update() error
- func (p ManagerEbuild) Upgrade() error
- type ManagerPacman
- func (p ManagerPacman) Clean() error
- func (p ManagerPacman) Install(name ...string) error
- func (p ManagerPacman) Purge(name ...string) error
- func (p ManagerPacman) Remove(name ...string) error
- func (p ManagerPacman) Update() error
- func (p ManagerPacman) Upgrade() error
- type ManagerPkg
- func (p ManagerPkg) Clean() error
- func (p ManagerPkg) Install(name ...string) error
- func (p ManagerPkg) Purge(name ...string) error
- func (p ManagerPkg) Remove(name ...string) error
- func (p ManagerPkg) Update() error
- func (p ManagerPkg) Upgrade() error
- type ManagerRpm
- func (p ManagerRpm) Clean() error
- func (p ManagerRpm) Install(name ...string) error
- func (p ManagerRpm) Purge(name ...string) error
- func (p ManagerRpm) Remove(name ...string) error
- func (p ManagerRpm) Update() error
- func (p ManagerRpm) Upgrade() error
- type ManagerZypp
- func (p ManagerZypp) Clean() error
- func (p ManagerZypp) Install(name ...string) error
- func (p ManagerZypp) Purge(name ...string) error
- func (p ManagerZypp) Remove(name ...string) error
- func (p ManagerZypp) Update() error
- func (p ManagerZypp) Upgrade() error
- type PackageType
- type System
Variables ¶
var ListSystem = [...]System{FreeBSD, Linux, MacOS, Windows}
ListSystem is the list of allowed operating systems.
Functions ¶
func SetupLogger ¶
SetupLogger setups the loggers used by some packages. 'log' is used by the packages 'edi', 'fileutil' and 'userutil'. 'logShell' is used by the packages 'executil' and 'pkg'.
func SystemFromGOOS ¶
SystemFromGOOS returns the system from 'GOOS', and the distribution at Linux systems.
Types ¶
type Distro ¶
type Distro int
Distro represents a distribution of Linux system.
Most used Linux distributions.
func DetectDistro ¶
DetectDistro returns the Linux distribution.
func (Distro) String ¶
type Manager ¶
type Manager 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 }
Manager is the common interface to handle different package systems.
func NewPkgFromSystem ¶
NewPkgFromSystem returns the package manager used by a system.
func NewPkgFromType ¶
func NewPkgFromType(pkg PackageType) Manager
NewPkgFromType returns the interface to handle the package manager.
type ManagerBrew ¶
type ManagerBrew struct{}
ManagerBrew is the interface to handle the macOS package manager.
func (ManagerBrew) Clean ¶
func (p ManagerBrew) Clean() error
func (ManagerBrew) Install ¶
func (p ManagerBrew) Install(name ...string) error
func (ManagerBrew) Purge ¶
func (p ManagerBrew) Purge(name ...string) error
func (ManagerBrew) Remove ¶
func (p ManagerBrew) Remove(name ...string) error
func (ManagerBrew) Update ¶
func (p ManagerBrew) Update() error
func (ManagerBrew) Upgrade ¶
func (p ManagerBrew) Upgrade() error
type ManagerDeb ¶
type ManagerDeb struct{}
ManagerDeb is the interface to handle the package manager of Linux systems based at Debian.
func (ManagerDeb) Clean ¶
func (p ManagerDeb) Clean() error
func (ManagerDeb) Install ¶
func (p ManagerDeb) Install(name ...string) error
func (ManagerDeb) Purge ¶
func (p ManagerDeb) Purge(name ...string) error
func (ManagerDeb) Remove ¶
func (p ManagerDeb) Remove(name ...string) error
func (ManagerDeb) Update ¶
func (p ManagerDeb) Update() error
func (ManagerDeb) Upgrade ¶
func (p ManagerDeb) Upgrade() error
type ManagerEbuild ¶
type ManagerEbuild struct{}
ManagerEbuild is the interface to handle the package manager of Linux systems based at Gentoo.
func (ManagerEbuild) Clean ¶
func (p ManagerEbuild) Clean() error
func (ManagerEbuild) Install ¶
func (p ManagerEbuild) Install(name ...string) error
func (ManagerEbuild) Purge ¶
func (p ManagerEbuild) Purge(name ...string) error
func (ManagerEbuild) Remove ¶
func (p ManagerEbuild) Remove(name ...string) error
func (ManagerEbuild) Update ¶
func (p ManagerEbuild) Update() error
func (ManagerEbuild) Upgrade ¶
func (p ManagerEbuild) Upgrade() error
type ManagerPacman ¶
type ManagerPacman struct{}
ManagerPacman is the interface to handle the package manager of Linux systems based at Arch.
func (ManagerPacman) Clean ¶
func (p ManagerPacman) Clean() error
func (ManagerPacman) Install ¶
func (p ManagerPacman) Install(name ...string) error
func (ManagerPacman) Purge ¶
func (p ManagerPacman) Purge(name ...string) error
func (ManagerPacman) Remove ¶
func (p ManagerPacman) Remove(name ...string) error
func (ManagerPacman) Update ¶
func (p ManagerPacman) Update() error
func (ManagerPacman) Upgrade ¶
func (p ManagerPacman) Upgrade() error
type ManagerPkg ¶
type ManagerPkg struct{}
ManagerPkg is the interface to handle the FreeBSD package manager, called 'package' or 'pkg'.
func (ManagerPkg) Clean ¶
func (p ManagerPkg) Clean() error
func (ManagerPkg) Install ¶
func (p ManagerPkg) Install(name ...string) error
func (ManagerPkg) Purge ¶
func (p ManagerPkg) Purge(name ...string) error
func (ManagerPkg) Remove ¶
func (p ManagerPkg) Remove(name ...string) error
func (ManagerPkg) Update ¶
func (p ManagerPkg) Update() error
func (ManagerPkg) Upgrade ¶
func (p ManagerPkg) Upgrade() error
type ManagerRpm ¶
type ManagerRpm struct{}
ManagerRpm is the interface to handle the package manager of Linux systems based at Red Hat.
func (ManagerRpm) Clean ¶
func (p ManagerRpm) Clean() error
func (ManagerRpm) Install ¶
func (p ManagerRpm) Install(name ...string) error
func (ManagerRpm) Purge ¶
func (p ManagerRpm) Purge(name ...string) error
func (ManagerRpm) Remove ¶
func (p ManagerRpm) Remove(name ...string) error
func (ManagerRpm) Update ¶
func (p ManagerRpm) Update() error
func (ManagerRpm) Upgrade ¶
func (p ManagerRpm) Upgrade() error
type ManagerZypp ¶
type ManagerZypp struct{}
ManagerZypp is the interface to handle the package manager of Linux systems based at SUSE.
func (ManagerZypp) Clean ¶
func (p ManagerZypp) Clean() error
func (ManagerZypp) Install ¶
func (p ManagerZypp) Install(name ...string) error
func (ManagerZypp) Purge ¶
func (p ManagerZypp) Purge(name ...string) error
func (ManagerZypp) Remove ¶
func (p ManagerZypp) Remove(name ...string) error
func (ManagerZypp) Update ¶
func (p ManagerZypp) Update() error
func (ManagerZypp) Upgrade ¶
func (p ManagerZypp) Upgrade() error
type PackageType ¶
type PackageType int8
PackageType represents a package management system.
const ( // Linux Deb PackageType = iota + 1 RPM Pacman Ebuild Zypp // BSD Brew Pkg )
func Detect ¶
func Detect() (PackageType, error)
Detect tries to get the package system used in the system, looking for executables in directories "/usr/bin" and "/usr/local/bin".
func (PackageType) String ¶
func (pkg PackageType) String() string
type System ¶
type System uint8
System represents an operating system.
The operating systems.
func (System) String ¶
Source Files ¶
distro.go doc.go log.go p_brew.go p_deb.go p_ebuild.go p_pacman.go p_pkg.go p_rpm.go p_zypp.go pkg.go system.go
Directories ¶
Path | Synopsis |
---|---|
config | |
config/shconf | Package shconf implements a parser and scanner for the configuration in format shell-variable. |
edi | Package edi allows edit files. |
executil | Package executil lets to call to system commands. |
fileutil | Package fileutil handles common operations in files. |
internal | |
userutil | Package userutil provides access to UNIX users database in local files. |
userutil/crypt | Package crypt provides interface for password crypt functions and collects common constants. |
userutil/crypt/apr1_crypt | Package apr1_crypt implements the standard Unix MD5-crypt algorithm created by Poul-Henning Kamp for FreeBSD, and modified by the Apache project. |
userutil/crypt/common | Package common contains routines used by multiple password hashing algorithms. |
userutil/crypt/md5_crypt | Package md5_crypt implements the standard Unix MD5-crypt algorithm created by Poul-Henning Kamp for FreeBSD. |
userutil/crypt/sha256_crypt | Package sha256_crypt implements Ulrich Drepper's SHA256-crypt password hashing algorithm. |
userutil/crypt/sha512_crypt | Package sha512_crypt implements Ulrich Drepper's SHA512-crypt password hashing algorithm. |
- Version
- v1.1.7
- Published
- Aug 3, 2021
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- now –
Tools for package owners.