cmd/initContainer: Bind mount locations regardless of /run/host/etc
Bind mounting the locations at runtime doesn't really have anything to
do with whether /run/host/etc is present inside the Toolbx container.
The only possible exception could have been /etc/machine-id, but it
isn't, because the bind mount is only performed if the source at
/run/host/etc/machine-id is present.
This is a historical mistake that has persisted for a long time, since,
in practice, /run/host/etc will almost always exist inside the Toolbx
container. It's time to finally correct it.
Fallout from 9436bbece0
https://github.com/containers/toolbox/pull/1255
This commit is contained in:
parent
58638c5940
commit
aeae18920b
1 changed files with 12 additions and 12 deletions
|
@ -206,18 +206,6 @@ func initContainer(cmd *cobra.Command, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, mount := range initContainerMounts {
|
|
||||||
if err := mountBind(mount.containerPath, mount.source, mount.flags); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if utils.PathExists("/sys/fs/selinux") {
|
|
||||||
if err := mountBind("/sys/fs/selinux", "/usr/share/empty", ""); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if initContainerFlags.mediaLink {
|
if initContainerFlags.mediaLink {
|
||||||
|
@ -236,6 +224,18 @@ func initContainer(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, mount := range initContainerMounts {
|
||||||
|
if err := mountBind(mount.containerPath, mount.source, mount.flags); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if utils.PathExists("/sys/fs/selinux") {
|
||||||
|
if err := mountBind("/sys/fs/selinux", "/usr/share/empty", ""); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := user.Lookup(initContainerFlags.user); err != nil {
|
if _, err := user.Lookup(initContainerFlags.user); err != nil {
|
||||||
if err := configureUsers(initContainerFlags.uid,
|
if err := configureUsers(initContainerFlags.uid,
|
||||||
initContainerFlags.user,
|
initContainerFlags.user,
|
||||||
|
|
Loading…
Reference in a new issue