Documentation
¶
Index ¶
- func AddRepository(repo *Repository, configFolderPath string) error
- func EditRepository(old *Repository, new *Repository, configFolderPath string) error
- func RemoveRepository(repo *Repository, configFolderPath string) error
- type AptManager
- func (am *AptManager) CheckForUpdates() error
- func (am *AptManager) DistUpgrade() (err error)
- func (am *AptManager) Install(packs ...*Package) error
- func (am *AptManager) List() ([]*Package, error)
- func (am *AptManager) ListUpgradable() ([]*Package, error)
- func (am *AptManager) Remove(packs ...*Package) error
- func (am *AptManager) Search(pattern string) ([]*Package, error)
- func (am *AptManager) SetStderr(w io.Writer)
- func (am *AptManager) SetStdout(w io.Writer)
- func (am *AptManager) Upgrade(packs ...*Package) (err error)
- func (am *AptManager) UpgradeAll() (err error)
- type Package
- type Repository
- type RepositoryList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRepository ¶
func AddRepository(repo *Repository, configFolderPath string) error
AddRepository adds the specified repository by changing the specified APT config folder (usually /etc/apt). The new repository is saved into a file named "managed.list"
func EditRepository ¶
func EditRepository(old *Repository, new *Repository, configFolderPath string) error
EditRepository replace an old repo configuration with a new repo configuration in the specified APT config folder (usually /etc/apt).
func RemoveRepository ¶
func RemoveRepository(repo *Repository, configFolderPath string) error
RemoveRepository removes a repository from the repository list files found in the specified APT config folder (usually /etc/apt)
Types ¶
type AptManager ¶
type AptManager struct {
// contains filtered or unexported fields
}
AptManager creates an apt manager
func (*AptManager) CheckForUpdates ¶
func (am *AptManager) CheckForUpdates() error
CheckForUpdates runs an apt update to retrieve new packages available from the repositories
func (*AptManager) DistUpgrade ¶
func (am *AptManager) DistUpgrade() (err error)
DistUpgrade upgrades all upgradable packages, it may remove older versions to install newer ones.
func (*AptManager) Install ¶
func (am *AptManager) Install(packs ...*Package) error
Install installs a set of packages
func (*AptManager) List ¶
func (am *AptManager) List() ([]*Package, error)
List returns a list of packages available in the system with their respective status.
func (*AptManager) ListUpgradable ¶
func (am *AptManager) ListUpgradable() ([]*Package, error)
ListUpgradable return all the upgradable packages and the version that is going to be installed if an UpgradeAll is performed
func (*AptManager) Remove ¶
func (am *AptManager) Remove(packs ...*Package) error
Remove removes a set of packages
func (*AptManager) Search ¶
func (am *AptManager) Search(pattern string) ([]*Package, error)
Search list packages available in the system that match the search pattern
func (*AptManager) SetStderr ¶
func (am *AptManager) SetStderr(w io.Writer)
SetStderr sets stderr writer
func (*AptManager) SetStdout ¶
func (am *AptManager) SetStdout(w io.Writer)
SetStdout sets stdout writer
func (*AptManager) Upgrade ¶
func (am *AptManager) Upgrade(packs ...*Package) (err error)
Upgrade runs the upgrade for a set of packages
func (*AptManager) UpgradeAll ¶
func (am *AptManager) UpgradeAll() (err error)
UpgradeAll upgrade all upgradable packages
type Package ¶
type Package struct {
Name string
Status string
Architecture string
Version string
ShortDescription string
InstalledSizeKB int
}
Package is a package available in the APT system
type Repository ¶
type Repository struct {
Enabled bool
SourceRepo bool
Options string
URI string
Distribution string
Components string
Comment string
// contains filtered or unexported fields
}
Repository contains metadata about a repository installed in the system
func (*Repository) APTConfigLine ¶
func (r *Repository) APTConfigLine() string
APTConfigLine returns the "deb" or "deb-src" config line to put in source.list to install the Repository
func (*Repository) Equals ¶
func (r *Repository) Equals(repo *Repository) bool
Equals check if the Repository metadata are equivalent to the one provided as parameter. Two Repository are equivalent if all metadata matches with the exception of Enabled and Comment.
type RepositoryList ¶
type RepositoryList []*Repository
RepositoryList is an array of Repository definitions
func ParseAPTConfigFolder ¶
func ParseAPTConfigFolder(folderPath string) (RepositoryList, error)
ParseAPTConfigFolder scans an APT config folder (usually /etc/apt) to get information about all configured repositories, it scans also "source.list.d" subfolder to find all the "*.list" files.
func (RepositoryList) Contains ¶
func (r RepositoryList) Contains(repo *Repository) bool
Contains checks if a repository definition is contained in the RepositoryList
func (RepositoryList) Find ¶
func (r RepositoryList) Find(repoToFind *Repository) *Repository
Find search in the RepositoryList a repo that has the same metadata as the one passed as parameter