mirror of
https://github.com/rancher/os.git
synced 2025-08-31 14:23:11 +00:00
Fix the wrong symlinks when using the custom docker engine
This commit is contained in:
@@ -137,7 +137,7 @@ func consoleInitFunc() error {
|
||||
}
|
||||
}
|
||||
|
||||
baseSymlink := symLinkEngineBinary(cfg.Rancher.Docker.Engine)
|
||||
baseSymlink := symLinkEngineBinary()
|
||||
|
||||
if _, err := os.Stat(dockerCompletionFile); err == nil {
|
||||
baseSymlink = append(baseSymlink, symlink{
|
||||
|
@@ -86,14 +86,15 @@ func dockerInitAction(c *cli.Context) error {
|
||||
}
|
||||
|
||||
cfg := config.LoadConfig()
|
||||
baseSymlink := symLinkEngineBinary(cfg.Rancher.Docker.Engine)
|
||||
|
||||
for _, link := range baseSymlink {
|
||||
for _, link := range symLinkEngineBinary() {
|
||||
syscall.Unlink(link.newname)
|
||||
if _, err := os.Stat(link.oldname); err == nil {
|
||||
if err := os.Symlink(link.oldname, link.newname); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = checkZfsBackingFS(cfg.Rancher.Docker.StorageDriver, cfg.Rancher.Docker.Graph)
|
||||
if err != nil {
|
||||
|
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/rancher/os/config"
|
||||
"github.com/rancher/os/pkg/log"
|
||||
"github.com/rancher/os/pkg/util/versions"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -34,30 +33,27 @@ func formatImage(image string, cfg *config.CloudConfig) string {
|
||||
return image
|
||||
}
|
||||
|
||||
func symLinkEngineBinary(version string) []symlink {
|
||||
versionNum := strings.Replace(strings.Replace(version, "docker-", "", -1), "-ce", "", -1)
|
||||
func symLinkEngineBinary() []symlink {
|
||||
baseSymlink := []symlink{
|
||||
{"/usr/share/ros/os-release", "/usr/lib/os-release"},
|
||||
{"/usr/share/ros/os-release", "/etc/os-release"},
|
||||
|
||||
{"/var/lib/rancher/engine/docker", "/usr/bin/docker"},
|
||||
{"/var/lib/rancher/engine/dockerd", "/usr/bin/dockerd"},
|
||||
{"/var/lib/rancher/engine/docker-init", "/usr/bin/docker-init"},
|
||||
{"/var/lib/rancher/engine/docker-proxy", "/usr/bin/docker-proxy"},
|
||||
{"/usr/share/ros/os-release", "/usr/lib/os-release"},
|
||||
{"/usr/share/ros/os-release", "/etc/os-release"},
|
||||
}
|
||||
if versions.GreaterThanOrEqualTo(versionNum, "18.09.0") {
|
||||
baseSymlink = append(baseSymlink, []symlink{
|
||||
|
||||
// >= 18.09.0
|
||||
{"/var/lib/rancher/engine/containerd", "/usr/bin/containerd"},
|
||||
{"/var/lib/rancher/engine/ctr", "/usr/bin/ctr"},
|
||||
{"/var/lib/rancher/engine/containerd-shim", "/usr/bin/containerd-shim"},
|
||||
{"/var/lib/rancher/engine/runc", "/usr/bin/runc"},
|
||||
}...)
|
||||
} else {
|
||||
baseSymlink = append(baseSymlink, []symlink{
|
||||
|
||||
// < 18.09.0
|
||||
{"/var/lib/rancher/engine/docker-containerd", "/usr/bin/docker-containerd"},
|
||||
{"/var/lib/rancher/engine/docker-containerd-ctr", "/usr/bin/docker-containerd-ctr"},
|
||||
{"/var/lib/rancher/engine/docker-containerd-shim", "/usr/bin/docker-containerd-shim"},
|
||||
{"/var/lib/rancher/engine/docker-runc", "/usr/bin/docker-runc"},
|
||||
}...)
|
||||
}
|
||||
return baseSymlink
|
||||
}
|
||||
|
Reference in New Issue
Block a user