packaging: github.com/juju/packaging/commands Index | Files

package commands

import "github.com/juju/packaging/commands"

Package commands contains an interface which returns common package-manager related commands and the reference implementation for apt and yum-based systems.

Index

Package Files

apt.go commander.go interface.go snap.go utils.go yum.go zypper.go

Constants

const (
    // CentOSSourcesDir is the default directory in which yum sourcefiles
    // may be found.
    CentOSSourcesDir = "/etc/yum/repos.d"

    // CentOSYumKeyfileDir is the default directory for yum repository keys.
    CentOSYumKeyfileDir = "/etc/pki/rpm-gpg/"

    // CentOSSourcesFile is the default file which lists all core sources
    // for yum packages on CentOS.
    CentOSSourcesFile = "/etc/yum/repos.d/CentOS-Base.repo"

    // YumConfigFile is the default configuration file for yum settings.
    YumConfigFilePath = "/etc/yum.conf"
)
const (
    // OpenSUSESourcesDir is the default directory in which openSUSE sourcefiles
    // may be found.
    OpenSUSESourcesDir = "/etc/zypp/repos.d"

    // OpenSUSECredentialsDir is the sirectory for credentials.
    OpenSUSECredentialsDir = "/etc/zypp/credentials.d"

    // OpenSUSESourcesFile is the default file which lists all core sources
    // for zypper packages on OpenSUSE.
    OpenSUSESourcesFile = "/etc/zypp/repos.d/repo-oss.repo"

    // ZypperConfigFile is the default configuration file for yum settings.
    ZypperConfigFilePath = "/etc/zypp/zypp.conf"

    //OpenSUSE proxy settings
    OpenSUSEProxy = "/etc/sysconfig/proxy"
)
const (
    // AptConfFilePath is the full file path for the proxy settings that are
    // written by cloud-init and the machine environ worker.
    AptConfFilePath = "/etc/apt/apt.conf.d/95-juju-proxy-settings"
)

type PackageCommander Uses

type PackageCommander interface {
    // InstallPrerequisiteCmd returns the command that installs the
    // prerequisite package for repository-handling operations.
    InstallPrerequisiteCmd() string

    // UpdateCmd returns the command to update the local package list.
    UpdateCmd() string

    // UpgradeCmd returns the command which issues an upgrade on all packages
    // with available newer versions.
    UpgradeCmd() string

    // InstallCmd returns a *single* command that installs the given package(s).
    InstallCmd(...string) string

    // RemoveCmd returns a *single* command that removes the given package(s).
    RemoveCmd(...string) string

    // PurgeCmd returns the command that removes the given package(s) along
    // with any associated config files.
    PurgeCmd(...string) string

    // IsInstalledCmd returns the command which determines whether or not a
    // package is currently installed on the system.
    IsInstalledCmd(string) string

    // SearchCmd returns the command that determines whether the given package is
    // available for installation from the currently configured repositories.
    SearchCmd(string) string

    // ListAvailableCmd returns the command which will list all packages
    // available for installation from the currently configured repositories.
    // NOTE: includes already installed packages.
    ListAvailableCmd() string

    // ListInstalledCmd returns the command which will list all
    // packages currently installed on the system.
    ListInstalledCmd() string

    // ListRepositoriesCmd returns the command that lists all repositories
    // currently configured on the system.
    // NOTE: requires the prerequisite package whose installation command
    // is given by InstallPrerequisiteCmd().
    ListRepositoriesCmd() string

    // AddRepositoryCmd returns the command that adds a repository to the
    // list of available repositories.
    // NOTE: requires the prerequisite package whose installation command
    // is given by InstallPrerequisiteCmd().
    AddRepositoryCmd(string) string

    // RemoveRepositoryCmd returns the command that removes a given
    // repository from the list of available repositories.
    // NOTE: requires the prerequisite package whose installation command
    // is given by InstallPrerequisiteCmd().
    RemoveRepositoryCmd(string) string

    // CleanupCmd returns the command that cleans up all orphaned packages,
    // left-over files and previously-cached packages.
    CleanupCmd() string

    // GetProxyCmd returns the command which outputs the proxies set for the
    // given package management system.
    // NOTE: output may require some additional filtering.
    GetProxyCmd() string

    // ProxyConfigContents returns the format expected by the package manager
    // for proxy settings which can be written directly to the config file.
    ProxyConfigContents(proxy.Settings) string

    // SetProxyCmds returns the commands which write the proxy configuration
    // to the configuration file of the package manager.
    SetProxyCmds(proxy.Settings) []string
}

PackageCommander is the interface which provides runnable shell commands for various packaging-related operations.

func NewAptPackageCommander Uses

func NewAptPackageCommander() PackageCommander

NewAptPackageCommander returns a PackageCommander for apt-based systems.

func NewPackageCommander Uses

func NewPackageCommander(series string) (PackageCommander, error)

NewPackageCommander returns a new PackageCommander instance based on the given series.

func NewSnapPackageCommander Uses

func NewSnapPackageCommander() PackageCommander

NewSnapPackageCommander returns a PackageCommander for snap-based systems.

func NewYumPackageCommander Uses

func NewYumPackageCommander() PackageCommander

NewYumPackageCommander returns a PackageCommander for yum-based systems.

func NewZypperPackageCommander Uses

func NewZypperPackageCommander() PackageCommander

NewZypperPackageCommander returns a PackageCommander for zypper-based systems.

Package commands imports 3 packages (graph) and is imported by 11 packages. Updated 2019-09-11. Refresh now. Tools for package owners.