Files
LibreELEC.tv/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch
2016-07-29 10:05:07 -07:00

279 lines
13 KiB
Diff

# Created with
# 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_solaris.go b/cmd/dockerd/daemon_solaris.go
--- a/cmd/dockerd/daemon_solaris.go 2016-06-17 13:28:45.000000000 -0700
+++ b/cmd/dockerd/daemon_solaris.go 2016-06-23 10:53:28.544141675 -0700
@@ -39,7 +39,7 @@
}
func getDaemonConfDir() string {
- return "/etc/docker"
+ return "/storage/.kodi/userdata/addon_data/service.system.docker/config"
}
// setupConfigReloadTrap configures the USR2 signal to reload the configuration.
diff -Naur a/cmd/dockerd/daemon_unix.go b/cmd/dockerd/daemon_unix.go
--- a/cmd/dockerd/daemon_unix.go 2016-06-17 13:28:45.000000000 -0700
+++ b/cmd/dockerd/daemon_unix.go 2016-06-23 10:53:28.542141655 -0700
@@ -18,7 +18,7 @@
"github.com/docker/libnetwork/portallocator"
)
-const defaultDaemonConfigFile = "/etc/docker/daemon.json"
+const defaultDaemonConfigFile = "/storage/.kodi/userdata/addon_data/service.system.docker/config/daemon.json"
// currentUserIsOwner checks whether the current user is the owner of the given
// file.
@@ -44,7 +44,7 @@
}
func getDaemonConfDir() string {
- return "/etc/docker"
+ return "/storage/.kodi/userdata/addon_data/service.system.docker/config"
}
// setupConfigReloadTrap configures the USR2 signal to reload the configuration.
diff -Naur a/integration-cli/docker_cli_authz_unix_test.go b/integration-cli/docker_cli_authz_unix_test.go
--- a/integration-cli/docker_cli_authz_unix_test.go 2016-06-17 13:28:45.000000000 -0700
+++ b/integration-cli/docker_cli_authz_unix_test.go 2016-06-23 10:53:28.339139631 -0700
@@ -142,10 +142,10 @@
w.Write(b)
})
- err := os.MkdirAll("/etc/docker/plugins", 0755)
+ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755)
c.Assert(err, checker.IsNil)
- 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 = ioutil.WriteFile(fileName, []byte(s.server.URL), 0644)
c.Assert(err, checker.IsNil)
}
@@ -194,7 +194,7 @@
s.server.Close()
- err := os.RemoveAll("/etc/docker/plugins")
+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")
c.Assert(err, checker.IsNil)
}
diff -Naur a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go
--- a/integration-cli/docker_cli_daemon_test.go 2016-06-17 13:28:45.000000000 -0700
+++ b/integration-cli/docker_cli_daemon_test.go 2016-06-23 10:53:28.411140349 -0700
@@ -553,13 +553,13 @@
func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *check.C) {
// TODO: skip or update for Windows daemon
- os.Remove("/etc/docker/key.json")
+ os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json")
if err := s.d.Start(); err != nil {
c.Fatalf("Could not start daemon: %v", err)
}
s.d.Stop()
- k, err := libtrust.LoadKeyFile("/etc/docker/key.json")
+ k, err := libtrust.LoadKeyFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json")
if err != nil {
c.Fatalf("Error opening key file")
}
@@ -572,7 +572,7 @@
func (s *DockerDaemonSuite) TestDaemonKeyMigration(c *check.C) {
// TODO: skip or update for Windows daemon
- os.Remove("/etc/docker/key.json")
+ os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json")
k1, err := libtrust.GenerateECP256PrivateKey()
if err != nil {
c.Fatalf("Error generating private key: %s", err)
@@ -589,7 +589,7 @@
}
s.d.Stop()
- k2, err := libtrust.LoadKeyFile("/etc/docker/key.json")
+ k2, err := libtrust.LoadKeyFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json")
if err != nil {
c.Fatalf("Error opening key file")
}
@@ -1337,7 +1337,7 @@
Y string `json:"y"`
}
- os.Remove("/etc/docker/key.json")
+ os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json")
if err := s.d.Start(); err != nil {
c.Fatalf("Failed to start daemon: %v", err)
}
@@ -1347,7 +1347,7 @@
}
config := &Config{}
- bytes, err := ioutil.ReadFile("/etc/docker/key.json")
+ bytes, err := ioutil.ReadFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json")
if err != nil {
c.Fatalf("Error reading key.json file: %s", err)
}
@@ -1367,11 +1367,11 @@
}
// write back
- if err := ioutil.WriteFile("/etc/docker/key.json", newBytes, 0400); err != nil {
+ if err := ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json", newBytes, 0400); err != nil {
c.Fatalf("Error ioutil.WriteFile: %s", err)
}
- defer os.Remove("/etc/docker/key.json")
+ defer os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json")
if err := s.d.Start(); err == nil {
c.Fatalf("It should not be successful to start daemon with wrong key: %v", err)
diff -Naur a/integration-cli/docker_cli_external_graphdriver_unix_test.go b/integration-cli/docker_cli_external_graphdriver_unix_test.go
--- a/integration-cli/docker_cli_external_graphdriver_unix_test.go 2016-06-17 13:28:45.000000000 -0700
+++ b/integration-cli/docker_cli_external_graphdriver_unix_test.go 2016-06-23 10:53:28.444140678 -0700
@@ -321,10 +321,10 @@
respond(w, &graphDriverResponse{Size: size})
})
- err = os.MkdirAll("/etc/docker/plugins", 0755)
- c.Assert(err, check.IsNil, check.Commentf("error creating /etc/docker/plugins"))
+ err = os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755)
+ c.Assert(err, check.IsNil, check.Commentf("error creating /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins"))
- specFile := "/etc/docker/plugins/" + name + "." + ext
+ specFile := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/" + name + "." + ext
err = ioutil.WriteFile(specFile, b, 0644)
c.Assert(err, check.IsNil, check.Commentf("error writing to %s", specFile))
}
@@ -333,8 +333,8 @@
s.server.Close()
s.jserver.Close()
- err := os.RemoveAll("/etc/docker/plugins")
- c.Assert(err, check.IsNil, check.Commentf("error removing /etc/docker/plugins"))
+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")
+ c.Assert(err, check.IsNil, check.Commentf("error removing /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins"))
}
func (s *DockerExternalGraphdriverSuite) TestExternalGraphDriver(c *check.C) {
diff -Naur a/integration-cli/docker_cli_external_volume_driver_unix_test.go b/integration-cli/docker_cli_external_volume_driver_unix_test.go
--- a/integration-cli/docker_cli_external_volume_driver_unix_test.go 2016-06-17 13:28:45.000000000 -0700
+++ b/integration-cli/docker_cli_external_volume_driver_unix_test.go 2016-06-23 10:53:28.435140588 -0700
@@ -239,17 +239,17 @@
send(w, `{"Capabilities": { "Scope": "global" }}`)
})
- err := os.MkdirAll("/etc/docker/plugins", 0755)
+ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755)
c.Assert(err, checker.IsNil)
- err = ioutil.WriteFile("/etc/docker/plugins/test-external-volume-driver.spec", []byte(s.server.URL), 0644)
+ err = ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/test-external-volume-driver.spec", []byte(s.server.URL), 0644)
c.Assert(err, checker.IsNil)
}
func (s *DockerExternalVolumeSuite) TearDownSuite(c *check.C) {
s.server.Close()
- err := os.RemoveAll("/etc/docker/plugins")
+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")
c.Assert(err, checker.IsNil)
}
@@ -334,7 +334,7 @@
// Make sure a request to use a down driver doesn't block other requests
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *check.C) {
- specPath := "/etc/docker/plugins/down-driver.spec"
+ specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/down-driver.spec"
err := ioutil.WriteFile(specPath, []byte("tcp://127.0.0.7:9999"), 0644)
c.Assert(err, check.IsNil)
defer os.RemoveAll(specPath)
@@ -373,7 +373,7 @@
err := s.d.StartWithBusybox()
c.Assert(err, checker.IsNil)
- specPath := "/etc/docker/plugins/test-external-volume-driver-retry.spec"
+ specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/test-external-volume-driver-retry.spec"
os.RemoveAll(specPath)
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 2016-06-17 13:28:45.000000000 -0700
+++ b/integration-cli/docker_cli_network_unix_test.go 2016-06-23 10:53:28.441140648 -0700
@@ -201,14 +201,14 @@
}
})
- err := os.MkdirAll("/etc/docker/plugins", 0755)
+ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755)
c.Assert(err, checker.IsNil)
- 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 = ioutil.WriteFile(fileName, []byte(url), 0644)
c.Assert(err, checker.IsNil)
- 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 = ioutil.WriteFile(ipamFileName, []byte(url), 0644)
c.Assert(err, checker.IsNil)
}
@@ -220,7 +220,7 @@
s.server.Close()
- err := os.RemoveAll("/etc/docker/plugins")
+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")
c.Assert(err, checker.IsNil)
}
diff -Naur a/pkg/plugins/discovery.go b/pkg/plugins/discovery.go
--- a/pkg/plugins/discovery.go 2016-06-17 13:28:45.000000000 -0700
+++ b/pkg/plugins/discovery.go 2016-06-23 10:53:28.636142593 -0700
@@ -16,7 +16,7 @@
// ErrNotFound plugin not found
ErrNotFound = errors.New("plugin not found")
socketsPath = "/run/docker/plugins"
- specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}
+ specsPaths = []string{"/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", "/usr/lib/docker/plugins"}
)
// localRegistry defines a registry that is local (using unix socket).
diff -Naur a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go
--- a/pkg/plugins/plugins.go 2016-06-17 13:28:45.000000000 -0700
+++ b/pkg/plugins/plugins.go 2016-06-23 10:53:28.636142593 -0700
@@ -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 2016-06-17 13:28:45.000000000 -0700
+++ b/registry/config_unix.go 2016-06-23 10:53:28.594142174 -0700
@@ -4,7 +4,7 @@
var (
// CertsDir is the directory where certificates are stored
- CertsDir = "/etc/docker/certs.d"
+ CertsDir = "/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
diff -Naur a/registry/endpoint_v1.go b/registry/endpoint_v1.go
--- a/registry/endpoint_v1.go 2016-06-17 13:28:45.000000000 -0700
+++ b/registry/endpoint_v1.go 2016-06-23 10:53:28.593142164 -0700
@@ -49,7 +49,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 fallback to HTTP.
- return fmt.Errorf("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 fmt.Errorf("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)
}
// If registry is insecure and HTTPS failed, fallback to HTTP.