config

package
v0.0.0-...-b9bb202 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package config defines an interface which returns packaging-related configuration options and operations depending on the desired package-management system.

Index

Constants

View Source
const (
	// AptSourcesFile is the default file which list all core
	// sources for apt packages on an apt-based system.
	AptSourcesFile = "/etc/apt/sources.list"

	// AptListsDirectory is the location of the APT sources list.
	AptListsDirectory = "/var/lib/apt/lists"

	// AptConfigDirectory is the default directory in which
	// apt configuration files are stored.
	AptConfigDirectory = "/etc/apt/apt.conf.d"

	// ExtractAptArchiveSource is a shell command that will extract the
	// currently configured APT archive source location. We assume that
	// the first source for "main" in the file is the one that
	// should be replaced throughout the file.
	ExtractAptArchiveSource = `awk "/^deb .* $(awk -F= '/DISTRIB_CODENAME=/ {gsub(/"/,""); print $2}' /etc/lsb-release) .*main.*\$/{print \$2;exit}" ` + AptSourcesFile

	// ExtractAptSecuritySource is a shell command that will extract the
	// currently configured APT security source location. We assume that
	// the first source for "main" in the file is the one that
	// should be replaced throughout the file.
	ExtractAptSecuritySource = `awk "/^deb .* $(awk -F= '/DISTRIB_CODENAME=/ {gsub(/"/,""); print $2}' /etc/lsb-release)-security .*main.*\$/{print \$2;exit}" ` + AptSourcesFile

	// AptSourceListPrefix is a shell program that translates an
	// APT source (piped from stdin) to a file prefix. The algorithm
	// involves stripping up to one trailing slash, stripping the
	// URL scheme prefix, and finally translating slashes to
	// underscores.
	AptSourceListPrefix = `sed 's,.*://,,' | sed 's,/$,,' | tr / _`
)
View Source
const (
	// PackageManagerLoopFunction is a bash function that executes its arguments
	// in a loop with a delay until either the command either returns
	// with an exit code other than 100. It times out after 5 failed attempts.
	PackageManagerLoopFunction = `` /* 357-byte string literal not displayed */

)

Variables

View Source
var (
	// AptProxyConfigFile is the full file path for the proxy settings that are
	// written by cloudinit and the machine environ worker.
	AptProxyConfigFile = AptConfigDirectory + "/95-juju-proxy-settings"

	// AptPreferenceTemplate is the template specific to an apt preference file.
	AptPreferenceTemplate = template.Must(template.New("").Parse(`
Explanation: {{.Explanation}}
Package: {{.Package}}
Pin: {{.Pin}}
Pin-Priority: {{.Priority}}
`[1:]))

	// AptSourceTemplate is the template specific to an apt source file.
	AptSourceTemplate = template.Must(template.New("").Parse(`
# {{.Name}} (added by Juju)
deb {{.URL}} %s main
# deb-src {{.URL}} %s main
`[1:]))
)
View Source
var (
	// DefaultPackages is a list of the default packages Juju'd like to see
	// installed on all it's machines.
	DefaultPackages = []string{

		"curl",
	}
)
View Source
var UbuntuDefaultPackages = append(DefaultPackages, []string{

	"python-software-properties",
}...)

UbuntuDefaultPackages is the default package set we'd like to installed on all Ubuntu machines.

View Source
var UbuntuDefaultRepositories = []string{}

UbuntuDefaultRepositories is the default repository set we'd like to enable on all Ubuntu machines.

Functions

This section is empty.

Types

type PackagingConfigurer

type PackagingConfigurer interface {
	// DefaultPackages returns a list of default packages which should be
	// installed the vast majority of cases on any specific machine
	DefaultPackages() []string

	// IsCloudArchivePackage signals whether the given package is a
	// cloud archive package and thus should be set as such.
	IsCloudArchivePackage(pack string) bool

	// ApplyCloudArchiveTarget returns the package with the required target
	// release bits preceding it.
	ApplyCloudArchiveTarget(pack string) []string

	// RenderSource returns the os-specific full file contents
	// of a given PackageSource.
	RenderSource(src source.PackageSource) (string, error)

	// RenderPreferences returns the os-specific full file contents of a given
	// set of PackagePreferences.
	RenderPreferences(prefs source.PackagePreferences) (string, error)
}

PackagingConfigurer is an interface which handles various packaging-related configuration functions for the specific distribution it represents.

func NewAptPackagingConfigurer

func NewAptPackagingConfigurer() PackagingConfigurer

NewAptPackagingConfigurer returns a PackagingConfigurer for apt-based systems.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL