Last active
January 22, 2021 23:53
-
-
Save tfmoraes/583bb66269216768fbe72b4e57cdd221 to your computer and use it in GitHub Desktop.
etc_static.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/cmd/create.go b/src/cmd/create.go | |
index 74e90b1..c94e44d 100644 | |
--- a/src/cmd/create.go | |
+++ b/src/cmd/create.go | |
@@ -298,6 +298,56 @@ func createContainer(container, image, release string, showCommandToEnter bool) | |
kcmSocketMount = []string{"--volume", kcmSocketMountArg} | |
} | |
+ var etcStaticMount []string | |
+ var resolveMount []string | |
+ var hostconfMount []string | |
+ var hostsMount []string | |
+ | |
+ if utils.PathExists("/etc/static") { | |
+ logrus.Debug("Checking if /etc/static is a symbolic link") | |
+ | |
+ var etcStaticLink string | |
+ etcStaticLink, err = os.Readlink("/etc/static") | |
+ if err != nil { | |
+ logrus.Debug(err) | |
+ } | |
+ if etcStaticLink != "/etc/static" { | |
+ var resolveLink string | |
+ var hostconfLink string | |
+ var hostsLink string | |
+ | |
+ logrus.Debug("/etc/static is a symbolic link") | |
+ etcStaticMount = []string{"--volume", etcStaticLink + ":" + etcStaticLink + ":ro", "--volume", etcStaticLink + ":" + "/etc/static:ro"} | |
+ | |
+ resolveLink, err = os.Readlink("/etc/static/resolv.conf") | |
+ if err != nil { | |
+ logrus.Debug(err) | |
+ } | |
+ if resolveLink != "/etc/static/resolv.conf" { | |
+ logrus.Debug("/etc/resolv.conf is a symbolic link") | |
+ resolveMount = []string{"--volume", resolveLink + ":/run/host/etc/resolv.conf:ro"} | |
+ } | |
+ | |
+ hostconfLink, err = os.Readlink("/etc/static/host.conf") | |
+ if err != nil { | |
+ logrus.Debug(err) | |
+ } | |
+ if hostconfLink != "/etc/static/host.conf" { | |
+ logrus.Debug("/etc/host.conf is a symbolic link") | |
+ hostconfMount = []string{"--volume", hostconfLink + ":/run/host/etc/host.conf:ro"} | |
+ } | |
+ | |
+ hostsLink, err = os.Readlink("/etc/static/hosts") | |
+ if err != nil { | |
+ logrus.Debug(err) | |
+ } | |
+ if hostsLink != "/etc/static/hosts" { | |
+ logrus.Debug("/etc/hosts is a symbolic link") | |
+ hostsMount = []string{"--volume", hostsLink + ":/run/host/etc/hosts:ro"} | |
+ } | |
+ } | |
+ } | |
+ | |
var mediaLink []string | |
var mediaMount []string | |
@@ -432,6 +482,11 @@ func createContainer(container, image, release string, showCommandToEnter bool) | |
createArgs = append(createArgs, runMediaMount...) | |
createArgs = append(createArgs, toolboxShMount...) | |
+ createArgs = append(createArgs, etcStaticMount...) | |
+ createArgs = append(createArgs, resolveMount...) | |
+ createArgs = append(createArgs, hostconfMount...) | |
+ createArgs = append(createArgs, hostsMount...) | |
+ | |
createArgs = append(createArgs, []string{ | |
imageFull, | |
}...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment