Files
LibreELEC.tv/packages/addons/addon-depends/docker/moby/patches/moby-001-user-addon-storage-location.patch
2025-03-22 10:40:40 +00:00

273 lines
14 KiB
Diff

# when updating this patch just create it from scratch using this command
#
# find . -name "*.go" -print | xargs sed -i 's/\/etc\/docker/\/storage\/.kodi\/userdata\/addon_data\/service.system.docker\/config/g'
#
#
diff -Naur a/cmd/dockerd/daemon_unix.go b/cmd/dockerd/daemon_unix.go
--- a/cmd/dockerd/daemon_unix.go 2025-02-19 21:53:46.000000000 +0000
+++ b/cmd/dockerd/daemon_unix.go 2025-02-20 10:29:44.441745187 +0000
@@ -21,7 +21,7 @@
func getDefaultDaemonConfigDir() string {
if !honorXDG {
- return "/etc/docker"
+ return "/storage/.kodi/userdata/addon_data/service.system.docker/config"
}
// NOTE: CLI uses ~/.docker while the daemon uses ~/.config/docker, because
// ~/.docker was not designed to store daemon configurations.
diff -Naur a/cmd/dockerd/options.go b/cmd/dockerd/options.go
--- a/cmd/dockerd/options.go 2025-02-19 21:53:46.000000000 +0000
+++ b/cmd/dockerd/options.go 2025-02-20 10:29:44.441449933 +0000
@@ -39,7 +39,7 @@
//
// - DOCKER_CONFIG only affects TLS certificates, but does not change the
// location for the actual *daemon configuration* (which defaults to
- // "/etc/docker/daemon.json").
+ // "/storage/.kodi/userdata/addon_data/service.system.docker/config/daemon.json").
// - If no value is set, configDir uses "~/.docker/" as default, but does
// not take $XDG_CONFIG_HOME into account (it uses pkg/homedir.Get, which
// is not XDG_CONFIG_HOME-aware).
@@ -52,7 +52,7 @@
// We should:
//
// - deprecate DOCKER_CONFIG for the daemon
- // - decide where the TLS certs should live by default ("/etc/docker/"?)
+ // - decide where the TLS certs should live by default ("/storage/.kodi/userdata/addon_data/service.system.docker/config/"?)
// - look at "when" (and when _not_) XDG_CONFIG_HOME should be used. Its
// needed for rootless, but perhaps could be used for non-rootless(?)
// - When changing the location for TLS config, (ideally) they should
diff -Naur a/integration/plugin/authz/authz_plugin_test.go b/integration/plugin/authz/authz_plugin_test.go
--- a/integration/plugin/authz/authz_plugin_test.go 2025-02-19 21:53:46.000000000 +0000
+++ b/integration/plugin/authz/authz_plugin_test.go 2025-02-20 10:29:44.406641256 +0000
@@ -56,15 +56,15 @@
ctrl = &authorizationController{}
- err := os.MkdirAll("/etc/docker/plugins", 0o755)
+ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0o755)
assert.NilError(t, err)
- fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", testAuthZPlugin)
+ fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", testAuthZPlugin)
err = os.WriteFile(fileName, []byte(server.URL), 0o644)
assert.NilError(t, err)
t.Cleanup(func() {
- err := os.RemoveAll("/etc/docker/plugins")
+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")
assert.NilError(t, err)
ctrl = nil
})
diff -Naur a/integration-cli/docker_cli_external_volume_driver_test.go b/integration-cli/docker_cli_external_volume_driver_test.go
--- a/integration-cli/docker_cli_external_volume_driver_test.go 2025-02-19 21:53:46.000000000 +0000
+++ b/integration-cli/docker_cli_external_volume_driver_test.go 2025-02-20 10:29:44.713041018 +0000
@@ -266,10 +266,10 @@
send(w, `{"Capabilities": { "Scope": "global" }}`)
})
- err := os.MkdirAll("/etc/docker/plugins", 0o755)
+ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0o755)
assert.NilError(t, err)
- err = os.WriteFile("/etc/docker/plugins/"+name+".spec", []byte(s.Server.URL), 0o644)
+ err = os.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/"+name+".spec", []byte(s.Server.URL), 0o644)
assert.NilError(t, err)
return s
}
@@ -277,7 +277,7 @@
func (s *DockerExternalVolumeSuite) TearDownSuite(ctx context.Context, c *testing.T) {
s.volumePlugin.Close()
- err := os.RemoveAll("/etc/docker/plugins")
+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")
assert.NilError(c, err)
}
@@ -371,7 +371,7 @@
// Make sure a request to use a down driver doesn't block other requests
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *testing.T) {
- specPath := "/etc/docker/plugins/down-driver.spec"
+ specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/down-driver.spec"
err := os.WriteFile(specPath, []byte("tcp://127.0.0.7:9999"), 0o644)
assert.NilError(c, err)
defer os.RemoveAll(specPath)
diff -Naur a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go
--- a/integration-cli/docker_cli_network_unix_test.go 2025-02-19 21:53:46.000000000 +0000
+++ b/integration-cli/docker_cli_network_unix_test.go 2025-02-20 10:29:44.713475312 +0000
@@ -226,14 +226,14 @@
}
})
- err := os.MkdirAll("/etc/docker/plugins", 0o755)
+ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0o755)
assert.NilError(t, err)
- fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", netDrv)
+ fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", netDrv)
err = os.WriteFile(fileName, []byte(url), 0o644)
assert.NilError(t, err)
- ipamFileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", ipamDrv)
+ ipamFileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", ipamDrv)
err = os.WriteFile(ipamFileName, []byte(url), 0o644)
assert.NilError(t, err)
}
@@ -245,7 +245,7 @@
s.server.Close()
- err := os.RemoveAll("/etc/docker/plugins")
+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")
assert.NilError(c, err)
}
diff -Naur a/integration-cli/docker_cli_swarm_test.go b/integration-cli/docker_cli_swarm_test.go
--- a/integration-cli/docker_cli_swarm_test.go 2025-02-19 21:53:46.000000000 +0000
+++ b/integration-cli/docker_cli_swarm_test.go 2025-02-20 10:29:44.716710173 +0000
@@ -825,14 +825,14 @@
}
})
- err := os.MkdirAll("/etc/docker/plugins", 0o755)
+ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0o755)
assert.NilError(t, err)
- fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", netDrv)
+ fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", netDrv)
err = os.WriteFile(fileName, []byte(url), 0o644)
assert.NilError(t, err)
- ipamFileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", ipamDrv)
+ ipamFileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", ipamDrv)
err = os.WriteFile(ipamFileName, []byte(url), 0o644)
assert.NilError(t, err)
}
@@ -845,7 +845,7 @@
setupRemoteGlobalNetworkPlugin(c, mux, s.server.URL, globalNetworkPlugin, globalIPAMPlugin)
defer func() {
s.server.Close()
- err := os.RemoveAll("/etc/docker/plugins")
+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")
assert.NilError(c, err)
}()
diff -Naur a/libnetwork/drivers/remote/driver_test.go b/libnetwork/drivers/remote/driver_test.go
--- a/libnetwork/drivers/remote/driver_test.go 2025-02-19 21:53:46.000000000 +0000
+++ b/libnetwork/drivers/remote/driver_test.go 2025-02-20 10:29:44.707404748 +0000
@@ -44,7 +44,7 @@
}
func setupPlugin(t *testing.T, name string, mux *http.ServeMux) func() {
- specPath := "/etc/docker/plugins"
+ specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins"
if runtime.GOOS == "windows" {
specPath = filepath.Join(os.Getenv("programdata"), "docker", "plugins")
}
diff -Naur a/libnetwork/ipams/remote/remote_test.go b/libnetwork/ipams/remote/remote_test.go
--- a/libnetwork/ipams/remote/remote_test.go 2025-02-19 21:53:46.000000000 +0000
+++ b/libnetwork/ipams/remote/remote_test.go 2025-02-20 10:29:44.699434031 +0000
@@ -38,7 +38,7 @@
}
func setupPlugin(t *testing.T, name string, mux *http.ServeMux) func() {
- specPath := "/etc/docker/plugins"
+ specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins"
if runtime.GOOS == "windows" {
specPath = filepath.Join(os.Getenv("programdata"), "docker", "plugins")
}
diff -Naur a/libnetwork/libnetwork_unix_test.go b/libnetwork/libnetwork_unix_test.go
--- a/libnetwork/libnetwork_unix_test.go 2025-02-19 21:53:46.000000000 +0000
+++ b/libnetwork/libnetwork_unix_test.go 2025-02-20 10:29:44.709262867 +0000
@@ -2,4 +2,4 @@
package libnetwork_test
-var specPath = "/etc/docker/plugins"
+var specPath = "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins"
diff -Naur a/pkg/plugins/discovery.go b/pkg/plugins/discovery.go
--- a/pkg/plugins/discovery.go 2025-02-19 21:53:46.000000000 +0000
+++ b/pkg/plugins/discovery.go 2025-02-20 10:29:44.412930502 +0000
@@ -128,12 +128,12 @@
//
// On Unix in non-rootless mode:
//
-// - "/etc/docker/plugins"
+// - "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins"
// - "/usr/lib/docker/plugins"
//
// On Unix in rootless-mode:
//
-// - "$XDG_CONFIG_HOME/docker/plugins" (or "/etc/docker/plugins" if $XDG_CONFIG_HOME is not set)
+// - "$XDG_CONFIG_HOME/docker/plugins" (or "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins" if $XDG_CONFIG_HOME is not set)
// - "$HOME/.local/lib/docker/plugins" (pr "/usr/lib/docker/plugins" if $HOME is set)
func SpecsPaths() []string {
return specsPaths()
diff -Naur a/pkg/plugins/discovery_unix.go b/pkg/plugins/discovery_unix.go
--- a/pkg/plugins/discovery_unix.go 2025-02-19 21:53:46.000000000 +0000
+++ b/pkg/plugins/discovery_unix.go 2025-02-20 10:29:44.412746807 +0000
@@ -12,7 +12,7 @@
if configHome, err := homedir.GetConfigHome(); err != nil {
return filepath.Join(configHome, "docker/plugins")
}
- return "/etc/docker/plugins"
+ return "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins"
}
func rootlessLibPluginsPath() string {
@@ -27,5 +27,5 @@
if rootless.RunningWithRootlessKit() {
return []string{rootlessConfigPluginsPath(), rootlessLibPluginsPath()}
}
- return []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}
+ return []string{"/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", "/usr/lib/docker/plugins"}
}
diff -Naur a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go
--- a/pkg/plugins/plugins.go 2025-02-19 21:53:46.000000000 +0000
+++ b/pkg/plugins/plugins.go 2025-02-20 10:29:44.413216747 +0000
@@ -4,7 +4,7 @@
// Docker discovers plugins by looking for them in the plugin directory whenever
// a user or container tries to use one by name. UNIX domain socket files must
// be located under /run/docker/plugins, whereas spec files can be located
-// either under /etc/docker/plugins or /usr/lib/docker/plugins. This is handled
+// either under /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins or /usr/lib/docker/plugins. This is handled
// by the Registry interface, which lets you list all plugins or get a plugin by
// its name if it exists.
//
diff -Naur a/registry/config_unix.go b/registry/config_unix.go
--- a/registry/config_unix.go 2025-02-19 21:53:46.000000000 +0000
+++ b/registry/config_unix.go 2025-02-20 10:29:44.712430143 +0000
@@ -5,7 +5,7 @@
// defaultCertsDir is the platform-specific default directory where certificates
// are stored. On Linux, it may be overridden through certsDir, for example, when
// running in rootless mode.
-const defaultCertsDir = "/etc/docker/certs.d"
+const defaultCertsDir = "/storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d"
// cleanPath is used to ensure that a directory name is valid on the target
// platform. It will be passed in something *similar* to a URL such as
diff -Naur a/registry/search_endpoint_v1.go b/registry/search_endpoint_v1.go
--- a/registry/search_endpoint_v1.go 2025-02-19 21:53:46.000000000 +0000
+++ b/registry/search_endpoint_v1.go 2025-02-20 10:29:44.712695815 +0000
@@ -54,7 +54,7 @@
if endpoint.IsSecure {
// If registry is secure and HTTPS failed, show user the error and tell them about `--insecure-registry`
// in case that's what they need. DO NOT accept unknown CA certificates, and DO NOT fall back to HTTP.
- return nil, invalidParamf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host)
+ return nil, invalidParamf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host)
}
// registry is insecure and HTTPS failed, fallback to HTTP.
diff -Naur a/vendor/github.com/containerd/containerd/v2/core/remotes/docker/config/hosts.go b/vendor/github.com/containerd/containerd/v2/core/remotes/docker/config/hosts.go
--- a/vendor/github.com/containerd/containerd/v2/core/remotes/docker/config/hosts.go 2025-02-19 21:53:46.000000000 +0000
+++ b/vendor/github.com/containerd/containerd/v2/core/remotes/docker/config/hosts.go 2025-02-20 10:29:44.668972179 +0000
@@ -578,7 +578,7 @@
return filepath.Join(base, p)
}
-// loadCertsDir loads certs from certsDir like "/etc/docker/certs.d" .
+// loadCertsDir loads certs from certsDir like "/storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d" .
// Compatible with Docker file layout
// - files ending with ".crt" are treated as CA certificate files
// - files ending with ".cert" are treated as client certificates, and