summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorLawrence Chan <element103@gmail.com>2019-06-07 00:46:41 -0500
committerLawrence Chan <element103@gmail.com>2019-06-14 17:42:05 -0500
commit6ea12e302877f7ce1b77d3dafc4d0aa51839840c (patch)
tree577af2735d0243fd38c2abd129d8aa3358b950e8 /libpod
parent185b413e3d10ba001c4d1670a50dad77507154d7 (diff)
downloadpodman-6ea12e302877f7ce1b77d3dafc4d0aa51839840c.tar.gz
podman-6ea12e302877f7ce1b77d3dafc4d0aa51839840c.tar.bz2
podman-6ea12e302877f7ce1b77d3dafc4d0aa51839840c.zip
Improve DESTDIR/PREFIX/ETCDIR handling
- PREFIX is now passed saved in the binary at build-time so that default paths match installation paths. - ETCDIR is also overridable in a similar way. - DESTDIR is now applied on top of PREFIX for install/uninstall steps. Previously, a DESTDIR=/foo PREFIX=/bar make would install into /bar, rather than /foo/bar. Signed-off-by: Lawrence Chan <element103@gmail.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/runtime.go12
-rw-r--r--libpod/version.go6
2 files changed, 13 insertions, 5 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 24bb5f61c..c2a387083 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -42,11 +42,13 @@ const (
SQLiteStateStore RuntimeStateStore = iota
// BoltDBStateStore is a state backed by a BoltDB database
BoltDBStateStore RuntimeStateStore = iota
+)
+var (
// SeccompDefaultPath defines the default seccomp path
- SeccompDefaultPath = "/usr/share/containers/seccomp.json"
+ SeccompDefaultPath = installPrefix + "/share/containers/seccomp.json"
// SeccompOverridePath if this exists it overrides the default seccomp path
- SeccompOverridePath = "/etc/crio/seccomp.json"
+ SeccompOverridePath = etcDir + "/crio/seccomp.json"
// ConfigPath is the path to the libpod configuration file
// This file is loaded to replace the builtin default config before
@@ -54,11 +56,11 @@ const (
// If it is not present, the builtin default config is used instead
// This path can be overridden when the runtime is created by using
// NewRuntimeFromConfig() instead of NewRuntime()
- ConfigPath = "/usr/share/containers/libpod.conf"
+ ConfigPath = installPrefix + "/share/containers/libpod.conf"
// OverrideConfigPath is the path to an override for the default libpod
// configuration file. If OverrideConfigPath exists, it will be used in
// place of the configuration file pointed to by ConfigPath.
- OverrideConfigPath = "/etc/containers/libpod.conf"
+ OverrideConfigPath = etcDir + "/containers/libpod.conf"
// DefaultInfraImage to use for infra container
DefaultInfraImage = "k8s.gcr.io/pause:3.1"
@@ -300,7 +302,7 @@ func defaultRuntimeConfig() (RuntimeConfig, error) {
TmpDir: "",
MaxLogSize: -1,
NoPivotRoot: false,
- CNIConfigDir: "/etc/cni/net.d/",
+ CNIConfigDir: etcDir + "/cni/net.d/",
CNIPluginDir: []string{"/usr/libexec/cni", "/usr/lib/cni", "/usr/local/lib/cni", "/opt/cni/bin"},
InfraCommand: DefaultInfraCommand,
InfraImage: DefaultInfraImage,
diff --git a/libpod/version.go b/libpod/version.go
index d2b99a275..b876efddd 100644
--- a/libpod/version.go
+++ b/libpod/version.go
@@ -15,6 +15,12 @@ var (
// BuildInfo is the time at which the binary was built
// It will be populated by the Makefile.
buildInfo string
+ // InstallPrefix is the prefix where podman will be installed.
+ // It will be populated by the Makefile.
+ installPrefix string = "/usr/local"
+ // EtcDir is the sysconfdir where podman should look for system config files.
+ // It will be populated by the Makefile.
+ etcDir string = "/etc"
)
//Version is an output struct for varlink