Files
LibreELEC.tv/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch
2016-04-21 02:50:34 -07:00

267 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/docker/daemon_unix.go b/docker/daemon_unix.go
--- a/docker/daemon_unix.go 2016-04-13 11:03:42.000000000 -0700
+++ b/docker/daemon_unix.go 2016-04-21 02:39:35.588218701 -0700
@@ -16,7 +16,7 @@
"github.com/docker/docker/pkg/system"
)
-const defaultDaemonConfigFile = "/etc/docker/daemon.json"
+const defaultDaemonConfigFile = "/storage/.kodi/userdata/addon_data/service.system.docker/config/daemon.json"
func setPlatformServerConfig(serverConfig *apiserver.Config, daemonCfg *daemon.Config) *apiserver.Config {
serverConfig.EnableCors = daemonCfg.EnableCors
@@ -49,7 +49,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-04-13 11:03:42.000000000 -0700
+++ b/integration-cli/docker_cli_authz_unix_test.go 2016-04-21 02:39:35.417217012 -0700
@@ -134,10 +134,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)
}
@@ -186,7 +186,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-04-13 11:03:42.000000000 -0700
+++ b/integration-cli/docker_cli_daemon_test.go 2016-04-21 02:39:35.482217654 -0700
@@ -511,13 +511,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")
}
@@ -530,7 +530,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)
@@ -547,7 +547,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")
}
@@ -1295,7 +1295,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)
}
@@ -1305,7 +1305,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)
}
@@ -1325,11 +1325,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-04-13 11:03:42.000000000 -0700
+++ b/integration-cli/docker_cli_external_graphdriver_unix_test.go 2016-04-21 02:39:35.509217920 -0700
@@ -283,18 +283,18 @@
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"))
- err = ioutil.WriteFile("/etc/docker/plugins/test-external-graph-driver.spec", []byte(s.server.URL), 0644)
- c.Assert(err, check.IsNil, check.Commentf("error writing to /etc/docker/plugins/test-external-graph-driver.spec"))
+ err = ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/test-external-graph-driver.spec", []byte(s.server.URL), 0644)
+ c.Assert(err, check.IsNil, check.Commentf("error writing to /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/test-external-graph-driver.spec"))
}
func (s *DockerExternalGraphdriverSuite) TearDownSuite(c *check.C) {
s.server.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_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go
--- a/integration-cli/docker_cli_network_unix_test.go 2016-04-13 11:03:42.000000000 -0700
+++ b/integration-cli/docker_cli_network_unix_test.go 2016-04-21 02:39:35.506217891 -0700
@@ -200,14 +200,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)
}
@@ -219,7 +219,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_start_volume_driver_unix_test.go b/integration-cli/docker_cli_start_volume_driver_unix_test.go
--- a/integration-cli/docker_cli_start_volume_driver_unix_test.go 2016-04-13 11:03:42.000000000 -0700
+++ b/integration-cli/docker_cli_start_volume_driver_unix_test.go 2016-04-21 02:39:35.514217970 -0700
@@ -216,17 +216,17 @@
send(w, nil)
})
- 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)
}
@@ -311,7 +311,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)
@@ -350,7 +350,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/pkg/plugins/discovery.go b/pkg/plugins/discovery.go
--- a/pkg/plugins/discovery.go 2016-04-13 11:03:42.000000000 -0700
+++ b/pkg/plugins/discovery.go 2016-04-21 02:39:35.668219491 -0700
@@ -15,7 +15,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-04-13 11:03:42.000000000 -0700
+++ b/pkg/plugins/plugins.go 2016-04-21 02:39:35.667219481 -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-04-13 11:03:42.000000000 -0700
+++ b/registry/config_unix.go 2016-04-21 02:39:35.629219106 -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-04-13 11:03:42.000000000 -0700
+++ b/registry/endpoint_v1.go 2016-04-21 02:39:35.629219106 -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.