Documentation ¶
Index ¶
- func AddRepository(repo *Repository, configFolderPath string) error
- func CheckForUpdates() (output []byte, err error)
- func DistUpgrade() (output []byte, err error)
- func Download(pack *Package, targetPath string) (output []byte, err error)
- func EditRepository(old *Repository, new *Repository, configFolderPath string) error
- func GetDependencies(pack *Package) (list []string, err error)
- func Install(targetPath string, packs ...*Package) (output []byte, err error)
- func InstallDry(packs ...*Package) (output []byte, err error)
- func Remove(packs ...*Package) (output []byte, err error)
- func RemoveRepository(repo *Repository, configFolderPath string) error
- func Upgrade(packs ...*Package) (output []byte, err error)
- func UpgradeAll() (output []byte, 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 CheckForUpdates ¶
CheckForUpdates runs an apt update to retrieve new packages available from the repositories
func DistUpgrade ¶
DistUpgrade upgrades all upgradable packages, it may remove older versions to install newer ones.
func Download ¶ added in v0.2.0
Download triest to downlaod a set of packages targetPath should be absolute.
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 GetDependencies ¶ added in v0.2.0
Get a list of dependencies, from the bottom up.
func InstallDry ¶ added in v0.1.1
Install tries to install a set of packages
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)
func UpgradeAll ¶
UpgradeAll upgrade all upgradable packages
Types ¶
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
func ListUpgradable ¶
ListUpgradable return all the upgradable packages and the version that is going to be installed if an UpgradeAll is performed
type Repository ¶
type Repository struct { Enabled bool SourceRepo bool Options string URI string Distribution string Components string Comment string ConfigFile string }
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