|
@@ -9,32 +9,23 @@ import (
|
|
)
|
|
)
|
|
|
|
|
|
func rootlessConfigPluginsPath() string {
|
|
func rootlessConfigPluginsPath() string {
|
|
- configHome, err := homedir.GetConfigHome()
|
|
|
|
- if err == nil {
|
|
|
|
|
|
+ if configHome, err := homedir.GetConfigHome(); err != nil {
|
|
return filepath.Join(configHome, "docker/plugins")
|
|
return filepath.Join(configHome, "docker/plugins")
|
|
}
|
|
}
|
|
-
|
|
|
|
return "/etc/docker/plugins"
|
|
return "/etc/docker/plugins"
|
|
}
|
|
}
|
|
|
|
|
|
func rootlessLibPluginsPath() string {
|
|
func rootlessLibPluginsPath() string {
|
|
- libHome, err := homedir.GetLibHome()
|
|
|
|
- if err == nil {
|
|
|
|
|
|
+ if libHome, err := homedir.GetLibHome(); err == nil {
|
|
return filepath.Join(libHome, "docker/plugins")
|
|
return filepath.Join(libHome, "docker/plugins")
|
|
}
|
|
}
|
|
-
|
|
|
|
return "/usr/lib/docker/plugins"
|
|
return "/usr/lib/docker/plugins"
|
|
}
|
|
}
|
|
|
|
|
|
-// SpecsPaths returns
|
|
|
|
-// { "%programdata%\docker\plugins" } on Windows,
|
|
|
|
-// { "/etc/docker/plugins", "/usr/lib/docker/plugins" } on Unix in non-rootless mode,
|
|
|
|
-// { "$XDG_CONFIG_HOME/docker/plugins", "$HOME/.local/lib/docker/plugins" } on Unix in rootless mode
|
|
|
|
-// with fallback to the corresponding path in non-rootless mode if $XDG_CONFIG_HOME or $HOME is not set.
|
|
|
|
-func SpecsPaths() []string {
|
|
|
|
|
|
+// specsPaths is the non-Windows implementation of [SpecsPaths].
|
|
|
|
+func specsPaths() []string {
|
|
if rootless.RunningWithRootlessKit() {
|
|
if rootless.RunningWithRootlessKit() {
|
|
return []string{rootlessConfigPluginsPath(), rootlessLibPluginsPath()}
|
|
return []string{rootlessConfigPluginsPath(), rootlessLibPluginsPath()}
|
|
}
|
|
}
|
|
-
|
|
|
|
return []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}
|
|
return []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}
|
|
}
|
|
}
|