mirror of
https://github.com/moby/moby.git
synced 2026-08-13 17:06:44 +00:00
34 lines
905 B
Go
34 lines
905 B
Go
//go:build !windows
|
|
|
|
package plugins
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/moby/moby/v2/pkg/homedir"
|
|
)
|
|
|
|
func rootlessConfigPluginsPath() string {
|
|
if configHome, err := homedir.GetConfigHome(); err != nil {
|
|
return filepath.Join(configHome, "docker/plugins")
|
|
}
|
|
return "/etc/docker/plugins"
|
|
}
|
|
|
|
func rootlessLibPluginsPath() string {
|
|
if libHome, err := homedir.GetLibHome(); err == nil {
|
|
return filepath.Join(libHome, "docker/plugins")
|
|
}
|
|
return "/usr/lib/docker/plugins"
|
|
}
|
|
|
|
// specsPaths is the non-Windows implementation of [SpecsPaths].
|
|
func specsPaths() []string {
|
|
// TODO(thaJeztah): switch back to daemon/internal/rootless.RunningWithRootlessKit if this package moves internal to the daemon.
|
|
if os.Getenv("ROOTLESSKIT_STATE_DIR") != "" {
|
|
return []string{rootlessConfigPluginsPath(), rootlessLibPluginsPath()}
|
|
}
|
|
return []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}
|
|
}
|